You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

37 lines
776 B

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