Arguments
Name | Type | Default | Description |
---|
id | string | | A unique ID |
type | string | fieldset | Type of the field |
title | string | | Title of the field |
default | array | | Default value from database, if the option doesn’t exist |
subtitle | string | | Subtitle to display below the title |
desc | string | | Description to display after the field |
help | string | | Text to display on the right-corner (as hover/popup) of the field |
class | string | | Extra CSS classes (space separated) to append to the field |
before | string | | Content to display before the field |
after | string | | Content to display after the field |
dependency | array | | Define field visibility depending on other field value |
attributes | array | | Extra HTML attributes to append to the field |
sanitize | string | | Callback function for sanitizing value |
validate | string | | Callback function for validating value |
EXTRAS | | | |
fields | array | | 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