/**
* Takes data from editmode and convert it to internal objects
*
* @param mixed $data
* @return void
*/
public function setDataFromEditmode($data)
{
// IMPORTANT: if you use this method be sure that the type of the property is already set
if (in_array($this->getType(), array("document", "asset", "object"))) {
$el = Element\Service::getElementByPath($this->getType(), $data);
$this->data = null;
if ($el) {
$this->data = $el->getId();
}
} else {
if ($this->type == "date") {
$this->data = new \Zend_Date($data);
} else {
if ($this->type == "bool") {
$this->data = false;
if (!empty($data)) {
$this->data = true;
}
} else {
// plain text
$this->data = $data;
}
}
}
return $this;
}