/** * @param HtmlElement $element * @param bool $left * * @return $this|self */ public function add(HtmlElement $element, bool $left = true) : self { if ($element instanceof Button) { $element->addClass('navbar-btn'); } elseif ($element instanceof Form) { $element->addClass('navbar-form'); $element->setInline(); } elseif ($element instanceof HtmlElement && $element->getTag() == '<p>') { $element->addClass('navbar-text'); } elseif ($element instanceof HtmlElement && $element->getTag() == '<ul>') { $element->addClass(['nav', 'navbar-nav']); } $element->addClass($left ? 'navbar-left' : 'navbar-right'); $this->elements->add($element); return $this; }