Ejemplo n.º 1
0
Archivo: Links.php Proyecto: stunti/zf2
 /**
  * Returns the root container of the given page
  *
  * When rendering a container, the render method still store the given
  * container as the root container, and unset it when done rendering. This
  * makes sure finder methods will not traverse above the container given
  * to the render method.
  *
  * @param  Zend_Navigaiton_Page $page  page to find root for
  * @return \Zend\Navigation\Container   the root container of the given page
  */
 protected function _findRoot(Page\Page $page)
 {
     if ($this->_root) {
         return $this->_root;
     }
     $root = $page;
     while ($parent = $page->getParent()) {
         $root = $parent;
         if ($parent instanceof Page\Page) {
             $page = $parent;
         } else {
             break;
         }
     }
     return $root;
 }