1. Home
  2. Docs
  3. WordPress Studio Framework
  4. Framework Fields
  5. Fieldset Field

Fieldset Field

Arguments

NameTypeDefaultDescription
idstring A unique ID
typestringfieldsetType of the field
titlestring Title of the field
defaultarray Default value from database, if the option doesn’t exist
subtitlestring Subtitle to display below the title
descstring Description to display after the field
helpstring Text to display on the right-corner (as hover/popup) of the field
classstring Extra CSS classes (space separated) to append to the field
beforestring Content to display before the field
afterstring Content to display after the field
dependencyarray Define field visibility depending on other field value
attributesarray Extra HTML attributes to append to the field
sanitizestring Callback function for sanitizing value
validatestring Callback function for validating value
EXTRAS   
fieldsarray An associative array containing fields for the fieldset

Simple Fieldset Field Example

array(
  'id' => 'test-fieldset',
  'type' => 'fieldset',
  'title' => 'Fieldset',
  'fields' => array(
    'array(
      'id' => 'example-text',
      'type' => 'text',
      'title' => 'Example Text',
    ),
    array(
      'id' => 'example-color',
      'type' => 'color',
      'title' => 'Example Color',
    ),
    array(
      'id' => 'example-switcher',
      'type' => 'switcher',
      'title' => 'Example Switcher',
    ),
  ),
),

Fieldset Field Example with Defaults

array(
  'id' => 'test-fieldset',
  'type' => 'fieldset',
  'title' => 'Fieldset',
  'fields' => array(
    'array(
      'id' => 'example-text',
      'type' => 'text',
      'title' => 'Example Text',
    ),
    array(
      'id' => 'example-color',
      'type' => 'color',
      'title' => 'Example Color',
    ),
    array(
      'id' => 'example-switcher',
      'type' => 'switcher',
      'title' => 'Example Switcher',
    ),
  ),
  'default' => array(
    'example-text' => 'This is default text',
    'example-color' => '#ffbc00',
    'example-switcher' => true,
  ),
),
Was this article helpful to you? Yes No

How can we help?