The arguments that are utilized in the Accordion field:
Name | Type | Default | Description of argument |
---|---|---|---|
id | string | A unique ID. This ID is used to get the value | |
type | string | accordion | Type of the field |
title | string | Title of the field | |
default | array | Default value from the 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 a 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. | |
accordions | array | An associative array containing fields for the fieldsets. |
There are two configuration examples in this documentation. The first is a simple accordion configuration and the second is an accordion example with associated default values.
Simple Accordion Field Example
array(
'id' => 'example-accordion-1',
'type' => 'accordion',
'title' => 'Accordion Example',
'accordions' => array(
array(
'title' => 'Accordion Tab One',
'icon' => 'fa fa-heart',
'fields' => array(
array(
'id' => 'example-text-1',
'type' => 'text',
'title' => 'Text',
),
)
),
array(
'title' => 'Accordion Tab Two',
'icon' => 'fa fa-gear',
'fields' => array(
array(
'id' => 'example-color-1',
'type' => 'color',
'title' => 'Color',
),
)
),
)
),
Accordion Field Example with Default Values
array(
'id' => 'example-accordion-2',
'type' => 'accordion',
'title' => 'Accordion Default Example',
'accordions' => array(
array(
'title' => 'Accordion Tab One',
'icon' => 'fa fa-heart',
'fields' => array(
array(
'id' => 'example-text-1',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'example-text-2',
'type' => 'text',
'title' => 'Text Two',
),
)
),
array(
'title' => 'Accordion Tab Two',
'icon' => 'fa fa-gear',
'fields' => array(
array(
'id' => 'example-color-1',
'type' => 'color',
'title' => 'Color',
),
)
),
),
'default' => array(
'example-text-1' => 'This is sample default data',
'example-text-2' => 'Some additional default values',
'example-color-1' => '#33ccdd',
),
),