src/View/Helper/Navigation/Navbar.php
protected function renderNavbarMenu(AbstractContainer $container, array $options)
    {
        // Create iterator
        $iterator = new \RecursiveIteratorIterator($container, \RecursiveIteratorIterator::SELF_FIRST);
        $iterator->setMaxDepth(self::MAX_RENDER_DEPTH);

        // Add pages
        $html      = '';
        $prevDepth = -1;
        foreach ($iterator as $page) {
            if (!$this->accept($page)) {
                continue;
            }
            // Create navbar page
            $depth = $iterator->getDepth();
            $html .= $this->renderNavbarMenuPage($page, $options, $depth, $prevDepth);

            // Store depth for next iteration
            $prevDepth = $depth;
        }

        // Check if any html was created
        if ($html) {
            // Close open ul/li tags
            for ($i = $prevDepth + 1; $i > 0; $i--) {
                $html .= '</li></ul>';
            }
        }

        return $html;
    }
protected function renderNavbarMenu(AbstractContainer $container, array $options)
    {
        // Create iterator
        $iterator = new \RecursiveIteratorIterator($container, \RecursiveIteratorIterator::SELF_FIRST);
        $iterator->setMaxDepth(self::MAX_RENDER_DEPTH);

        // Add pages
        $html      = '';
        $prevDepth = -1;
        foreach ($iterator as $page) {
            if (!$this->accept($page)) {
                continue;
            }
            // Create navbar page
            $depth = $iterator->getDepth();
            $html .= $this->renderNavbarMenuPage($page, $options, $depth, $prevDepth);

            // Store depth for next iteration
            $prevDepth = $depth;
        }

        // Check if any html was created
        if ($html) {
            // Close open ul/li tags
            for ($i = $prevDepth + 1; $i > 0; $i--) {
                $html .= '</li></ul>';
            }
        }

        return $html;
    }
protected function renderNavbarMenu ( AbstractContainer $ container , array $ options ) { // Create iterator $ iterator = new \ RecursiveIteratorIterator ( $ container , \ RecursiveIteratorIterator :: SELF_FIRST ) ; $ iterator -> setMaxDepth ( self :: MAX_RENDER_DEPTH ) ; // Add pages $ html = '' ; $ prevDepth = - 1 ; foreach ( $ iterator as $ page ) { if ( ! $ this -> accept ( $ page ) ) { continue ; } // Create navbar page $ depth = $ iterator -> getDepth ( ) ; $ html .= $ this -> renderNavbarMenuPage ( $ page , $ options , $ depth , $ prevDepth ) ; // Store depth for next iteration $ prevDepth = $ depth ; } // Check if any html was created if ( $ html ) { // Close open ul/li tags for ( $ i = $ prevDepth + 1 ; $ i > 0 ; $ i -- ) { $ html .= '</li></ul>' ; } } return $ html ; }
Render navbar menu

@param  AbstractContainer $container Container to render
@param  array             $options   Options for controlling rendering
@return string
Render navbar menu