public function render() { $id = $this->tag->getAttrib('id') ? $this->tag->getAttrib('id') . '_button' : uniqid(); $this->button->id($id); $this->ul->aria('labelledby', $id); return $this->tag->append($this->button->render())->append($this->ul->render())->render(); }
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; }