public function testAddAttributes() { $htmlElement = new HtmlElement(); $attributes = array('class' => 'you-know-it', 'style' => 'Fo sho'); $htmlElement->setAttributes($attributes); $htmlElement->addAttributes(array('my' => 'foo', 'your' => 'bar')); $this->assertEquals('<div class="you-know-it" style="Fo sho" my="foo" your="bar"></div>', $htmlElement->render()); }
/** * Returns close button * * @return string */ protected function renderCloseButton() { $button = new HtmlElement('button'); return $button->addAttributes(array('type' => 'button', 'data-dismiss' => 'modal', 'aria-hidden' => 'true'))->addClass('close')->setContent('×')->render(); }
/** * Invoke Tooltip * * @param string $title * @param string $content * @param string $href * * @return \SxBootstrap\View\Helper\Bootstrap\Label */ public function __invoke($title = null, $content = null, $href = null) { $element = new HtmlElement('a'); $element->addAttributes(array('data-toggle' => 'tooltip', 'rel' => 'tooltip')); $this->setElement($element); if (!is_null($title)) { $this->setTitle($title); } if (!is_null($content)) { $this->setContent($content); } if (!is_null($href)) { $this->setHref($href); } return clone $this; }