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

Sorter Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringsorterType of 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-corner (as hover/popup) 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   
disabledbooltrueFlag to display disabled items of the field
enabled_titlebool|stringEnabledText to display title of Enabled items. Set to false if want to hide title
disabled_titlebool|stringDisabledText 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',
    ),
  ),
),

 

Was this article helpful to you? Yes No

How can we help?