public function buildMenu() { $menu = new HtmlElement('span', ['class' => $this->_generateCssClass()]); $ul = new HtmlElement('ul'); $heading = new HtmlElement('li', ['class' => 'heading'], $this->_titleText); $ul->nest($heading); foreach ($this->_content as $item) { $li = new HtmlElement('li'); $a = new HtmlElement('a', ['href' => $item['href']]); $img = new HtmlElement('span', ['class' => 'image ' . $item['icon']]); $title = new HtmlElement('span', ['class' => 'title'], $item['title']); /**/ $text = $item['text']; if ($this->_menuType == self::TYPE_ARTICLES) { $length = 40; if (strlen($text) > $length) { $string = substr($text, 0, $length - 3); $text = substr($text, 0, strrpos($string, ' ')) . '...'; } else { $text .= '...'; } } $text = new HtmlElement('span', ['class' => 'text visible-desktop'], $text); $a->nest($img); $a->nest($title); $a->nest($text); $li->nest($a); $ul->nest($li); } $menu->nest($ul); return $menu; }
private function _getDefaultTemplate() { $controlGroup = (new HtmlElement("div", ["class" => "control-group {{errorclass}}"]))->nestElement("label", ["class" => "control-label", "for" => "{{labelfor}}"], "{{labelcontent}}"); $control = new HtmlElement("div", ["class" => "controls"], "{{input}}"); if ($this->_element->validationErrors()) { $control->nestElement("span", ["class" => "help-inline"], $this->_element->validationErrors()[0]); } return $controlGroup->nest($control)->render(); }
/** * @return HtmlElement */ protected function _buildElement() { $p = new HtmlElement('p', ['class' => 'supportTicket notify']); $i = new HtmlElement('i', ['class' => Icon32::ENVELOPE]); $span = new HtmlElement('span', ['class' => 'count'], $this->_count); $p->nest($i); $p->nest($span); return $p; }
public function render() { if (Session::getFlash('msg')) { $flash = new HtmlElement("div", ["class" => "alert alert-" . Session::getFlash('msg')->type], Session::getFlash('msg')->message); $flash->nestElement("button", ["type" => "button", "class" => "close", "data-dismiss" => "alert"], "×"); return $flash; } return ""; }
/** * @return IRenderable */ private function _buildBreadcrumb() { $breadcrumb = new HtmlElement("ul", ["class" => "breadcrumb"]); $breadcrumb->nestElement("li", [], "Steps")->nestElement("li", [], new HtmlElement("span", ["class" => "divider"], "»")); foreach ($this->_steps->getArrayCopy() as $stepKey => $step) { $active = $stepKey === $this->_steps->key() ? "active" : ""; /** * @var IWizardStep $step */ $content = sprintf("%d: %s%s", $stepKey + 1, $step->getName(), new HtmlElement("span", ["class" => "divider"], "")); $breadcrumb->nestElement("li", ["class" => $active], $content); } return $breadcrumb; }