| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- PFBC framework extension, HTML output is controlled | |
| 3 | 2 | class AccuaForm_Element_FieldsetBegin extends Element { |
| 4 | 3 | public function __construct($legend, $name = "", $properties = array()) { |
| 5 | 4 | $properties += array("legend" => $legend); |
| 6 | 5 | parent::__construct("", $name, $properties); |
| @@ -6,55 +5,8 @@ | ||
| 6 | 5 | parent::__construct("", $name, $properties); |
| 7 | 6 | } |
| 8 | 7 | |
| 9 | 8 | public function render() { |
| 10 | - $wrapperClass = $this->getWrapperCssClass(); | |
| 11 | - if (!empty($wrapperClass)) { | |
| 12 | - $existing = isset($this->attributes['class']) ? $this->attributes['class'] . ' ' : ''; | |
| 13 | - $this->attributes['class'] = $existing . $wrapperClass; | |
| 14 | - } | |
| 15 | - $wrapperID = $this->getWrapperCssId(); | |
| 16 | - if (!empty($wrapperID)) { | |
| 17 | - $this->attributes['id'] = $wrapperID; | |
| 18 | - } | |
| 19 | - | |
| 20 | - $legend = $this->attributes['legend']; | |
| 21 | - $style = isset($this->attributes['fieldset_style']) ? $this->attributes['fieldset_style'] : 'border-off-title-off'; | |
| 22 | - $exclude = array('legend', 'fieldset_style'); | |
| 23 | - | |
| 24 | - // Add border class for border-on variants | |
| 25 | - $has_border = in_array($style, array('border-on-title-off', 'border-on-title-inline', 'border-on-title-outside', 'border-on-title-inside'), true); | |
| 26 | - if ($has_border) { | |
| 27 | - $existing = isset($this->attributes['class']) ? $this->attributes['class'] . ' ' : ''; | |
| 28 | - $this->attributes['class'] = $existing . 'accua-fieldset-border'; | |
| 29 | - } | |
| 30 | - | |
| 31 | - switch ($style) { | |
| 32 | - case 'border-on-title-outside': | |
| 33 | - if ($legend !== '') { | |
| 34 | - echo '<p class="accua-fieldset-title-outer">', $legend, '</p>'; | |
| 35 | - } | |
| 36 | - echo '<fieldset ', $this->getAttributes($exclude), '>'; | |
| 37 | - break; | |
| 38 | - | |
| 39 | - case 'border-on-title-inside': | |
| 40 | - case 'border-off-title-on': | |
| 41 | - echo '<fieldset ', $this->getAttributes($exclude), '>'; | |
| 42 | - if ($legend !== '') { | |
| 43 | - echo '<p class="accua-fieldset-title-inner">', $legend, '</p>'; | |
| 44 | - } | |
| 45 | - break; | |
| 46 | - | |
| 47 | - case 'border-on-title-inline': | |
| 48 | - echo '<fieldset ', $this->getAttributes($exclude), '>'; | |
| 49 | - if ($legend !== '') { | |
| 50 | - echo '<legend>', $legend, '</legend>'; | |
| 51 | - } | |
| 52 | - break; | |
| 53 | - | |
| 54 | - default: // 'border-off-title-off', 'border-on-title-off' | |
| 55 | - echo '<fieldset ', $this->getAttributes($exclude), '>'; | |
| 56 | - break; | |
| 57 | - } | |
| 9 | + echo '<fieldset ', $this->getAttributes(array('legend')), ' ><legend>', $this->attributes["legend"], '</legend>'; | |
| 58 | 10 | } |
| 59 | 11 | |
| 60 | 12 | } |