Exemple #1
0
 /**
  * Builds a standard Dropdown that is rendered within a Nav, so the Button
  * is not going to be generated instead a LinkTo is generated to trigger the
  * dropdown menu.
  *
  * @param array $options Dropdown's options.
  * @param mixed $yield Dropdown's content.
  * @return ContentTag a ContentTag instance that represents a Dropdown within a Nav.
  */
 private function build_standard_dropdown_into_nav($options, $yield)
 {
     return new ContentTag('li', ['class' => 'dropdown'], function () use($options, $yield) {
         $nav_link_status = Base::get_nav_link();
         $dropdown_link_status = Base::get_dropdown_link();
         Base::set_dropdown_link(false);
         Base::set_nav_link(false);
         $link = new LinkTo(['href' => '#', 'class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'], function () use($options) {
             return [$options['caption'], new ContentTag('span', '', ['class' => 'caret'])];
         });
         Base::set_nav_link($nav_link_status);
         Base::set_dropdown_link($dropdown_link_status);
         return [$link, new ContentTag('ul', $yield, ['class' => $options['list_class'], 'role' => 'menu', 'aria-labelledby' => $options['id']])];
     });
 }