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() { if ( isset($this->attributes['disabled']) && $this->attributes['disabled'] !== false ) { return (string) Button::create($this->label, 'none', $this->attributes); } // add "button" to attribute @class $this->attributes['class'] .= ' button'; $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)); } }