Arguments
Name | Type | Default | Description |
---|
id | string | | A unique ID. This ID will be used to get the value |
type | string | color_group | 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 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 frunction for sanitizing value |
validate | string | | Callback function for validating value |
EXTRAS | | | |
options | array | | An array of object containing key/value(color) pairs representing the options |
Simple Color Group Field Example
array(
'id' => 'test-color-group',
'type' => 'color_group',
'title' => 'Color Group',
'options' => array(
'color1' => 'Color One',
'color2' => 'Color Two',
'color3' => 'Color Three',
',
),
Color Group Field Example with Defaults
array(
'id' => 'test-color-group',
'type' => 'color_group',
'title' => 'Color Group',
'options' => array(
'color1' => 'Color One',
'color2' => 'Color Two',
'color3' => 'Color Three',
',
'default' => array(
'color1' => '#ffce4b',
'color2' => '#ff595e',
'color3' => '0052cc',
),
),
Was this article helpful to you?
Yes
No