Пример #1
0
 /**
  * 
  * @param mixed $button
  * @param mixed $options
  * @return \PhpBootstrap\Bootstrap\Dropdown
  */
 public function setButton($button, $options = null)
 {
     $this->button = $button instanceof Button ? $button : new Button('dropdown_btn');
     $this->button->removeAttrib('name');
     $this->button->addClass('btn-default');
     if ($options) {
         $this->button->setOptions($options);
     }
     $this->button->addClass('dropdown-toggle')->data('toggle', 'dropdown')->aria('expanded', 'false')->setLabel($button . ' <span class="caret"></span>');
     return $this;
 }
Пример #2
0
 public function setHeader($brand = null, $href = null, $srOnly = 'Toggle navigation')
 {
     $buttonContent = '';
     if ($srOnly) {
         $screenReader = new Tag('span', $srOnly, ['class' => 'sr-only']);
         $buttonContent .= $screenReader->render();
     }
     $iconBar = new Tag('span', '', ['class' => 'icon-bar']);
     $buttonContent .= $iconBar->render() . $iconBar->render() . $iconBar->render();
     $button = new Button('toggle_navigation', ['label' => $buttonContent]);
     $button->addClass('navbar-toggle collapsed');
     $button->data('toggle', 'collapse');
     $button->removeAttrib('id');
     $button->removeAttrib('name');
     $button->removeClass('btn');
     if ($this->navbarCollapse->getAttrib('id')) {
         $button->data('target', '#' . $this->navbarCollapse->getAttrib('id'));
     }
     $this->navbarHeader->prepend($button);
     if ($brand) {
         $this->navbarHeader->append(new Link($brand, ['href' => $href ? $href : '#', 'class' => 'navbar-brand']));
     }
     return $this;
 }