1<?php 2 3namespace dokuwiki\Form; 4 5/** 6 * Class ButtonElement 7 * 8 * Represents a simple button 9 * 10 * @package dokuwiki\Form 11 */ 12class ButtonElement extends Element 13{ 14 /** @var string HTML content */ 15 protected $content = ''; 16 17 /** 18 * @param string $name 19 * @param string $content HTML content of the button. You have to escape it yourself. 20 */ 21 public function __construct($name, $content = '') 22 { 23 parent::__construct('button', ['name' => $name, 'value' => 1]); 24 $this->content = $content; 25 } 26 27 /** 28 * The HTML representation of this element 29 * 30 * @return string 31 */ 32 public function toHTML() 33 { 34 return '<button ' . buildAttributes($this->attrs(), true) . '>' . $this->content . '</button>'; 35 } 36} 37