public function reverseMap($object) { parent::reverseMap($object); $object->childs = null; $object->elements = array(); if (is_array($this->elements)) { foreach ($this->elements as $element) { $tag = Document_Tag::factory($element->type, $element->name, $this->id); $tag->getFromWebserviceImport($element); $object->elements[$element->name] = $tag; } } }
/** * @param $type * @param $name * @param array $options * @return Tag */ public function tag($type, $name, $options = array()) { $type = strtolower($type); try { // @todo add document-id to registry key | for example for embeded snippets // set suffixes if the tag is inside a block try { $blocks = Zend_Registry::get("pimcore_tag_block_current"); $numeration = Zend_Registry::get("pimcore_tag_block_numeration"); if (is_array($blocks) and count($blocks) > 0) { if ($type == "block") { $tmpBlocks = $blocks; $tmpNumeration = $numeration; array_pop($tmpBlocks); array_pop($tmpNumeration); $tmpName = $name; if (is_array($tmpBlocks)) { $tmpName = $name . implode("_", $tmpBlocks) . implode("_", $tmpNumeration); } if ($blocks[count($blocks) - 1] == $tmpName) { array_pop($blocks); array_pop($numeration); } } $name = $name . implode("_", $blocks) . implode("_", $numeration); } } catch (Exception $e) { } $document = $this->document; if ($document instanceof Document) { $tag = $document->getElement($name); if ($tag instanceof Document_Tag && $tag->getType() == $type) { // call the load() method if it exists to reinitialize the data (eg. from serializing, ...) if (method_exists($tag, "load")) { $tag->load(); } // set view & controller, editmode $tag->setController($this->controller); $tag->setView($this); $tag->setEditmode($this->editmode); $tag->setOptions($options); } else { $tag = Document_Tag::factory($type, $name, $document->getId(), $options, $this->controller, $this, $this->editmode); $document->setElement($name, $tag); } } return $tag; } catch (Exception $e) { Logger::warning($e); } }
/** * Returns the current tag's data for web service export * * @abstract * @return array */ public function getForWebserviceExport() { $el = parent::getForWebserviceExport(); if ($this->data["internal"]) { if (intval($this->data["internalId"]) > 0) { if ($this->data["internalType"] == "document") { $referencedDocument = Document::getById($this->data["internalId"]); if (!$referencedDocument instanceof Document) { //detected broken link $document = Document::getById($this->getDocumentId()); Element_Service::scheduleForSanityCheck($document); } } else { if ($this->data["internalType"] == "asset") { $referencedAsset = Asset::getById($this->data["internalId"]); if (!$referencedAsset instanceof Asset) { //detected broken link $document = Document::getById($this->getDocumentId()); Element_Service::scheduleForSanityCheck($document); } } } } } $el->data = $this->data; return $el; }
/** * @return array */ public function __sleep() { $finalVars = array(); $parentVars = parent::__sleep(); $blockedVars = array("element"); foreach ($parentVars as $key) { if (!in_array($key, $blockedVars)) { $finalVars[] = $key; } } return $finalVars; }
/** * @see Document_Tag_Interface::admin * @return string */ public function admin() { $html = parent::admin(); // get frontendcode for preview $html .= $this->frontend(); return $html; }
/** * @return array */ public function __sleep() { $this->__sleepData = $this->getDataForResource(); $this->elements = array(); return parent::__sleep(); }