/** * Sets parent container * * @param Zym_Navigation_Container $parent [optional] new parent to set, * defaults to null which will set * no parent * @return Zym_Navigation_Page */ public function setParent(Zym_Navigation_Container $parent = null) { // return if the given parent already is parent if ($parent === $this->_parent) { return $this; } // remove from old parent if page if (null !== $this->_parent && $this instanceof Zym_Navigation_Page) { $this->_parent->removePage($this); } // set new parent $this->_parent = $parent; // add to parent if page and not already a child if (null !== $this->_parent && $this instanceof Zym_Navigation_Page) { $this->_parent->addPage($this); } return $this; }
/** * Returns an array representation of the page * * @return array */ public function toArray() { return array_merge($this->getCustomProperties(), array('label' => $this->getlabel(), 'id' => $this->getId(), 'class' => $this->getClass(), 'title' => $this->getTitle(), 'target' => $this->getTarget(), 'position' => $this->getPosition(), 'resource' => $this->getResource(), 'privilege' => $this->getPrivilege(), 'active' => $this->isActive(), 'visible' => $this->isVisible(), 'type' => get_class($this), 'pages' => parent::toArray())); }