コード例 #1
0
ファイル: Nav.php プロジェクト: cobisja/boothelp
 /**
  * Initializes a Nav instance.
  *
  * @param array $options options the display options for the nav.
  * @param mixed $block Block to generate a customized inside nav content.
  */
 public function __construct($options = [], $block = null)
 {
     $num_args = $this->get_function_num_args(func_get_args());
     if (2 > $num_args && is_callable(func_get_arg($num_args - 1))) {
         $block = func_get_arg($num_args - 1);
         $options = [];
     }
     Base::set_nav_link(true);
     $nav = new ContentTag('ul', $this->nav_options($options), $block);
     Base::set_nav_link(false);
     $this->set_html_object($nav->get_html_object());
 }
コード例 #2
0
ファイル: Dropdown.php プロジェクト: cobisja/boothelp
 /**
  * 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']])];
     });
 }