[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Form/ -> ButtonElement.php (source)

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