Arguments
Name | Type | Default | Description |
---|
id | string | | A unique ID. This ID will be used to get the value |
type | string | button_set | Type of the field |
title | string | | Title of the field |
default | array|string | | 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 right-corder (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 | | | |
multiple | bool | false | Flag to allow multiple options to be chosen |
options | array | | An array of object containing key/value pairs representing the options |
Basic Button Set Example
array(
'id' => 'example-button-set',
'type' => 'button_set',
'title' => 'Button Set',
'options' => array(
'enabled' => 'Enabled',
'disabled' => 'Disabled',
),
'default' => 'enabled',
),
Button Set Example with Multiple Options
array(
'id' => 'example-button-set',
'type' => 'button_set',
'title' => 'Button Set Multiselect',
'multiple' => true,
'options' => array(
'aqua' => 'Aqua',
'cyan' => 'Cyan',
'golden' => 'Golden',
'indigo' => 'Indigo',
'lime' => 'Lime',
'navy' => 'Navy',
'purple' => 'Purple',
),
'default' => array('cyan','indigo','purple'),
),
Was this article helpful to you?
Yes
No