1. Home
  2. Docs
  3. WordPress Studio Framework
  4. Framework Fields
  5. Color Group Field

Color Group Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringcolor_groupType of the field
titlestring Title of the field
defaultarray Default value from database, if the option doesn’t exist
subtitlestring Subtitle to display below the title
descstring Description to display after the field
helpstring Text to display on right-corder (as hover/popup) of the field
classstring Extra CSS classes (space separated) to append to the field
beforestring Content to display before the field
afterstring Content to display after the field
dependencyarray Define field visibility depending on other field value
attributesarray Extra HTML attributes to append to the field
sanitizestring Callback frunction for sanitizing value
validatestring Callback function for validating value
EXTRAS   
optionsarray 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

How can we help?