public function addCloseButton() { $button = new HtmlButton("close-" . $this->identifier); $button->setProperties(array("class" => "close", "data-dismiss" => "alert", "aria-label" => "close")); $button->setValue('<span aria-hidden="true">×</span>'); $this->addToPropertyCtrl("class", "alert-dismissible", array("alert-dismissible")); $this->button = $button; }
/** * Add a button * @param string $value the button caption * @param string $style one of "btn-default","btn-primary","btn-success","btn-info","btn-warning","btn-danger" * @return HtmlButton */ public function addButton($value = "Okay", $style = "btn-primary") { $btn = new HtmlButton($this->identifier . "-" . $value); $btn->setStyle($style); $btn->setValue($value); $this->buttons[] = $btn; return $btn; }
/** * Sets the tagName's dropdown * @see \Ajax\bootstrap\html\BaseHtml::setTagName() */ public function setTagName($tagName) { if ($tagName == "button") { $this->class = "btn dropdown-toggle"; } return parent::setTagName($tagName); }
public function addElement($element) { $result = $element; $iid = sizeof($this->elements) + 1; if ($element instanceof HtmlDropdown || $element instanceof HtmlSplitbutton) { $this->addExistingDropDown($element); $this->elements[] = $element; } elseif ($element instanceof HtmlButton) { $this->elements[] = $element; } elseif (is_array($element)) { if (array_key_exists("glyph", $element)) { $bt = new HtmlGlyphButton($this->identifier . "-button-" . $iid); } elseif (array_key_exists("btnCaption", $element)) { if (array_key_exists("split", $element)) { $bt = new HtmlSplitbutton($this->identifier . "-dropdown-" . $iid); } else { $bt = new HtmlDropdown($this->identifier . "-dropdown-" . $iid); } $this->dropdownAsButton($bt); } else { $bt = new HtmlButton($this->identifier . "-button-" . $iid); } $bt->fromArray($element); $this->elements[] = $bt; $result = $bt; } elseif (is_string($element)) { $bt = new HtmlButton($this->identifier . "-button-" . $iid); $bt->setValue($element); $this->elements[] = $bt; $result = $bt; } return $result; }