OpenApi Gen: add toString method for easier testing
[dokuwiki.git] / inc / Form / FieldsetOpenElement.php
blob2d9925541cb056c4b25cb3caba09511ad2cdd649
1 <?php
3 namespace dokuwiki\Form;
5 /**
6 * Class FieldsetOpenElement
8 * Opens a Fieldset with an optional legend
10 * @package dokuwiki\Form
12 class FieldsetOpenElement extends TagOpenElement
14 /**
15 * @param string $legend
16 * @param array $attributes
18 public function __construct($legend = '', $attributes = [])
20 // this is a bit messy and we just do it for the nicer class hierarchy
21 // the parent would expect the tag in $value but we're storing the
22 // legend there, so we have to set the type manually
23 parent::__construct($legend, $attributes);
24 $this->type = 'fieldsetopen';
27 /**
28 * The HTML representation of this element
30 * @return string
32 public function toHTML()
34 $html = '<fieldset ' . buildAttributes($this->attrs()) . '>';
35 $legend = $this->val();
36 if ($legend) $html .= DOKU_LF . '<legend>' . hsc($legend) . '</legend>';
37 return $html;