Merge pull request #4038 from dokuwiki/create-pull-request/patch
[dokuwiki.git] / inc / Form / ButtonElement.php
blob3e110c62d740ca2119b7758d0633f456d9b94046
1 <?php
3 namespace dokuwiki\Form;
5 /**
6 * Class ButtonElement
8 * Represents a simple button
10 * @package dokuwiki\Form
12 class ButtonElement extends Element
14 /** @var string HTML content */
15 protected $content = '';
17 /**
18 * @param string $name
19 * @param string $content HTML content of the button. You have to escape it yourself.
21 public function __construct($name, $content = '')
23 parent::__construct('button', array('name' => $name, 'value' => 1));
24 $this->content = $content;
27 /**
28 * The HTML representation of this element
30 * @return string
32 public function toHTML()
34 return '<button ' . buildAttributes($this->attrs(), true) . '>'.$this->content.'</button>';