Пример #1
0
 /**
  * Searches the root container for forward 'subsection' relations of the
  * given $page
  *
  * From {@link http://www.w3.org/TR/html4/types.html#type-links}:
  * Refers to a document serving as a subsection in a collection of
  * documents.
  *
  * @param  \Zend\Navigation\Page\Page $page       page to find relation for
  * @return \Zend\Navigation\Page\Page|array|null  page(s) or null
  */
 public function searchRelSubsection(Page\Page $page)
 {
     $found = array();
     if ($page->hasPages()) {
         // given page has child pages, loop chapters
         foreach ($this->_findRoot($page) as $chapter) {
             // is page a section?
             if ($chapter->hasPage($page)) {
                 foreach ($page as $subsection) {
                     if ($this->accept($subsection)) {
                         $found[] = $subsection;
                     }
                 }
             }
         }
     }
     switch (count($found)) {
         case 0:
             return null;
         case 1:
             return $found[0];
         default:
             return $found;
     }
 }