public function addElement($element, $asIcon = false) { $elementO = $element; if (\is_string($element)) { if ($asIcon) { $elementO = new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content)); $elementO->asIcon($element); } else { $elementO = new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); } } $this->addContent($elementO); }
public function addAction($action, $direction = Direction::RIGHT, $icon = NULL, $labeled = false) { $actionO = $action; if (\is_object($action) === false) { $actionO = new HtmlButton("action-" . $this->identifier, $action); if (isset($icon)) { $actionO->addIcon($icon, true, $labeled); } } $this->addToProperty("class", $direction . " action"); $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); return $actionO; }
public function addAction($action) { if (!$action instanceof BaseHtml) { $class = ""; if (\array_search($action, ["Okay", "Yes"]) !== false) { $class = "approve"; } if (\array_search($action, ["Cancel", "No"]) !== false) { $class = "cancel"; } $action = new HtmlButton("action-" . $this->identifier, $action); if ($class !== "") { $action->addToProperty("class", $class); } } return $this->addElementInPart($action, "actions"); }
public static function icon($identifier, $icon) { $result = new HtmlButton($identifier); $result->asIcon($icon); return $result; }