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.
 
 
 
 
 

40 lines
995 B

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