1. Home
  2. Docs
  3. WordPress Studio Framework
  4. Framework Fields
  5. Button Set Field

Button Set Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringbutton_setType of the field
titlestring Title of the field
defaultarray|string 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 function for sanitizing value
validatestring Callback function for validating value
EXTRAS   
multipleboolfalseFlag to allow multiple options to be chosen
optionsarray 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

How can we help?