# contact-forms/2.3.0/classes/Element/FieldsetBegin.php

Contact Forms by Cimatti, version 2.3.0. 60 lines.

- Page: https://pluginprobe.com/plugins/contact-forms/2.3.0/code/classes/Element/FieldsetBegin.php
- Raw: https://pluginprobe.com/plugins/contact-forms/2.3.0/raw/classes/Element/FieldsetBegin.php
- Modified: 2026-07-13T10:04:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/contact-forms/2.3.0/code/classes/Element/FieldsetBegin.php#L10-L20`.

```php
<?php
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- PFBC framework extension, HTML output is controlled
class AccuaForm_Element_FieldsetBegin extends Element {
  public function __construct($legend, $name = "", $properties = array()) {
    $properties += array("legend" => $legend);
    parent::__construct("", $name, $properties);
  }
  
  public function render() {
    $wrapperClass = $this->getWrapperCssClass();
    if (!empty($wrapperClass)) {
      $existing = isset($this->attributes['class']) ? $this->attributes['class'] . ' ' : '';
      $this->attributes['class'] = $existing . $wrapperClass;
    }
    $wrapperID = $this->getWrapperCssId();
    if (!empty($wrapperID)) {
      $this->attributes['id'] = $wrapperID;
    }

    $legend  = $this->attributes['legend'];
    $style   = isset($this->attributes['fieldset_style']) ? $this->attributes['fieldset_style'] : 'border-off-title-off';
    $exclude = array('legend', 'fieldset_style');

    // Add border class for border-on variants
    $has_border = in_array($style, array('border-on-title-off', 'border-on-title-inline', 'border-on-title-outside', 'border-on-title-inside'), true);
    if ($has_border) {
      $existing = isset($this->attributes['class']) ? $this->attributes['class'] . ' ' : '';
      $this->attributes['class'] = $existing . 'accua-fieldset-border';
    }

    switch ($style) {
      case 'border-on-title-outside':
        if ($legend !== '') {
          echo '<p class="accua-fieldset-title-outer">', $legend, '</p>';
        }
        echo '<fieldset ', $this->getAttributes($exclude), '>';
        break;

      case 'border-on-title-inside':
      case 'border-off-title-on':
        echo '<fieldset ', $this->getAttributes($exclude), '>';
        if ($legend !== '') {
          echo '<p class="accua-fieldset-title-inner">', $legend, '</p>';
        }
        break;

      case 'border-on-title-inline':
        echo '<fieldset ', $this->getAttributes($exclude), '>';
        if ($legend !== '') {
          echo '<legend>', $legend, '</legend>';
        }
        break;

      default: // 'border-off-title-off', 'border-on-title-off'
        echo '<fieldset ', $this->getAttributes($exclude), '>';
        break;
    }
  }
  
}
```
