Ejemplo n.º 1
0
 /**
  * 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;
 }