[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

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

   1  <?php
   2  
   3  namespace dokuwiki\Form;
   4  
   5  /**
   6   * Class TagElement
   7   *
   8   * Creates a self closing HTML tag
   9   *
  10   * @package dokuwiki\Form
  11   */
  12  class TagElement extends ValueElement
  13  {
  14      /**
  15       * @param string $tag
  16       * @param array $attributes
  17       */
  18      public function __construct($tag, $attributes = [])
  19      {
  20          parent::__construct('tag', $tag, $attributes);
  21      }
  22  
  23      /**
  24       * The HTML representation of this element
  25       *
  26       * @return string
  27       */
  28      public function toHTML()
  29      {
  30          return '<' . $this->val() . ' ' . buildAttributes($this->attrs()) . ' />';
  31      }
  32  }