3 namespace dokuwiki\Form
;
6 * Class FieldsetOpenElement
8 * Opens a Fieldset with an optional legend
10 * @package dokuwiki\Form
12 class FieldsetOpenElement
extends TagOpenElement
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';
28 * The HTML representation of this element
32 public function toHTML()
34 $html = '<fieldset ' . buildAttributes($this->attrs()) . '>';
35 $legend = $this->val();
36 if ($legend) $html .= DOKU_LF
. '<legend>' . hsc($legend) . '</legend>';