public function renderDropDownMenu($container = null, array $options = array())
    {
        $menu = $this->getNavigationMenu()->renderMenu($container, $options);
        $query = new Query($menu, strtolower(mb_detect_encoding($menu)));
        $uls = $query->execute('li>ul');

        /** @var \DOMElement $ul */
        foreach ($uls as $key => $ul) {
            $caret = $uls->getDocument()->createDocumentFragment();
            $caret->appendXML('<b class="caret" />');
            $index = $key+1;

            $this->addCss('dropdown-menu', $ul);
            $ul->setAttribute('role', 'menu');
            $ul->setAttribute('aria-labelledby', "drop{$index}");

            $li = $ul->parentNode;
            $this->addCss('dropdown', $li);

            $a = $li->firstChild;
            $this->addCss('dropdown-toggle', $a);
            $a->setAttribute('role', 'button');
            $a->setAttribute('data-toggle', 'dropdown');
            $a->setAttribute('href', '#');
            $a->setAttribute('id', "drop{$index}");
            $a->appendChild($caret);
        }

        return preg_replace('~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\s*~i', '', $uls->getDocument()->saveHTML());
    }
public function renderDropDownMenu($container = null, array $options = array())
    {
        $menu = $this->getNavigationMenu()->renderMenu($container, $options);
        $query = new Query($menu, strtolower(mb_detect_encoding($menu)));
        $uls = $query->execute('li>ul');

        /** @var \DOMElement $ul */
        foreach ($uls as $key => $ul) {
            $caret = $uls->getDocument()->createDocumentFragment();
            $caret->appendXML('<b class="caret" />');
            $index = $key+1;

            $this->addCss('dropdown-menu', $ul);
            $ul->setAttribute('role', 'menu');
            $ul->setAttribute('aria-labelledby', "drop{$index}");

            $li = $ul->parentNode;
            $this->addCss('dropdown', $li);

            $a = $li->firstChild;
            $this->addCss('dropdown-toggle', $a);
            $a->setAttribute('role', 'button');
            $a->setAttribute('data-toggle', 'dropdown');
            $a->setAttribute('href', '#');
            $a->setAttribute('id', "drop{$index}");
            $a->appendChild($caret);
        }

        return preg_replace('~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\s*~i', '', $uls->getDocument()->saveHTML());
    }
public function renderDropDownMenu ( $ container = null , array $ options = array ( ) ) { $ menu = $ this -> getNavigationMenu ( ) -> renderMenu ( $ container , $ options ) ; $ query = new Query ( $ menu , strtolower ( mb_detect_encoding ( $ menu ) ) ) ; $ uls = $ query -> execute ( 'li>ul' ) ; /** @var \DOMElement $ul */ foreach ( $ uls as $ key => $ ul ) { $ caret = $ uls -> getDocument ( ) -> createDocumentFragment ( ) ; $ caret -> appendXML ( '<b class="caret" />' ) ; $ index = $ key + 1 ; $ this -> addCss ( 'dropdown-menu' , $ ul ) ; $ ul -> setAttribute ( 'role' , 'menu' ) ; $ ul -> setAttribute ( 'aria-labelledby' , "drop{$index}" ) ; $ li = $ ul -> parentNode ; $ this -> addCss ( 'dropdown' , $ li ) ; $ a = $ li -> firstChild ; $ this -> addCss ( 'dropdown-toggle' , $ a ) ; $ a -> setAttribute ( 'role' , 'button' ) ; $ a -> setAttribute ( 'data-toggle' , 'dropdown' ) ; $ a -> setAttribute ( 'href' , '#' ) ; $ a -> setAttribute ( 'id' , "drop{$index}" ) ; $ a -> appendChild ( $ caret ) ; } return preg_replace ( '~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\s*~i' , '' , $ uls -> getDocument ( ) -> saveHTML ( ) ) ; }
Render a dropdown menu

@param  string|\SpiffyNavigation\Container|null $container
@param  array                                   $options
@return string
Render a dropdown menu