Arguments
Name | Type | Default | Description |
---|---|---|---|
id | string | A unique ID. This ID will be used to get the value | |
type | string | sorter | Type of 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 right-corner (as hover/popup) 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 | |||
disabled | bool | true | Flag to display disabled items of the field |
enabled_title | bool|string | Enabled | Text to display title of Enabled items. Set to false if want to hide title |
disabled_title | bool|string | Disabled | Text to display title of Disabled items. Set to false if want to hide title |
Simple Sorter Field Example
array(
'id' => 'example-sorter',
'type' => 'sorter',
'title' => 'Sorter',
'default' => array(
'enabled' => array(
'opt1' => 'Option One',
'opt2' => 'Option Two',
'opt3' => 'Option Three',
),
'disabled' => array(
'opt4' => 'Option Four',
'opt5' => 'Option Five',
),
),
),
Sorter Field Example with Custom Title
array(
'id' => 'example-sorter',
'type' => 'sorter',
'title' => 'Sorter',
'default' => array(
'enabled' => array(
'opt1' => 'Option One',
'opt2' => 'Option Two',
'opt3' => 'Option Three',
),
'disabled' => array(
'opt4' => 'Option Four',
'opt5' => 'Option Five',
),
),
'enabled_title' => 'Activated',
'disabled_title' => 'Deactivated',
),
Sorter Field Example without “Disabled”
array(
'id' => 'example-sorter',
'type' => 'sorter',
'title' => 'Sorter',
'disabled' => false,
'default' => array(
'enabled' => array(
'opt1' => 'Option One',
'opt2' => 'Option Two',
'opt3' => 'Option Three',
),
),
),