HTML element. * * @param string $label the label of the button element * @param string $name the @name element of the button element * @param array $attributes the attributes of the button element */ protected function initialize($label, $name, $attributes) { $this->attributes['name'] = $name ?: $this->label; } /** * @return string returns a HTML representation of this button. */ public function __toString() { // add "button" to attribute @class if (!isset($this->attributes['class'])) { $this->attributes['class'] = ''; } $this->attributes['class'] .= ' button'; $attributes = []; ksort($this->attributes); foreach ($this->attributes as $k => $v) { $attributes[] = sprintf(' %s="%s"', $k, htmlReady($v)); } return sprintf( '', join('', $attributes), htmlReady($this->label) ); } }