HTML element. * * @param string $label the label of the element * @param string $url the @href element of the element * @param array $attributes the attributes of the element */ protected function initialize($label, $url, $attributes) { $this->attributes['href'] = $url ?: \URLHelper::getURL(); } /** * @return string returns a HTML representation of this hyperlink. */ public function __toString() { // add "button" to attribute @class @$this->attributes["class"] .= " button"; // add tabindex of zero to make buttons accesible when tabbing if (!isset($this->attributes['tabindex'])) { $this->attributes['tabindex'] = '0'; } $attributes = []; ksort($this->attributes); foreach ($this->attributes as $k => $v) { $attributes[] = sprintf(' %s="%s"', $k, htmlReady($v)); } // TODO: URLHelper...?! return sprintf('%s', join('', $attributes), htmlReady($this->label)); } }