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