<?php
/*
 * Copyright (c) 2013, webvariants GbR, http://www.webvariants.de
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

/**
 * Datentyp
 */
class WV14_Datatype extends _WV_Datatype_StringText {
	public function renderForm(sly_Form $form, WV_IProperty $property, $value) {
		if ($value === false) {
			$default = $property->getDefault();
			$value   = $property->isMultilingual() ? array($default) : $default;
		}
		elseif (!$property->isMultilingual()) {
			$value = reset($value);
		}

		$params = $property->getParams();
		extract($this->deserializeParams($params));

		$name   = 'property_'.$property->getID().'_value';
		$editor = new sly_Form_Wymeditor($name, $property->getTitle(), $value);

		$editor->setHelpText($property->getHelpText());
		$form->add($editor);

		return $form;
	}

	public function checkParamCompatibility(array $oldParameters, array $newParameters) {
		return true;
	}

	public function getIncompatibilityUpdateStatement(array $oldParameters, array $newParameters) {
		return array();
	}
}
