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
if (!isset($this->attributes['class'])) {
$this->attributes['class'] = '';
}
$this->attributes['class'] .= ' button';
// TODO: URLHelper...?!
return sprintf(
'%s',
arrayToHtmlAttributes($this->attributes),
htmlReady($this->label)
);
}
}