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

Sortable Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringsortableType 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   
fieldsarray An associative array containing fields for the sortable

Simple Sortable Field Example

array(
  'id' => 'example-sortable',
  'type' => 'sortable',
  'title' => 'Example Sortable',
  'fields' => array(
    array(
      'id' => 'test-text-1',
      'type' => 'text',
      'title' => 'Text',
    ),
    array(
      'id' => 'test-text-2',
      'type' => 'text',
      'title' => 'Text Two',
    ),
  ),
),

Sortable Field Example with Defaults

array(
  'id' => 'example-sortable',
  'type' => 'sortable',
  'title' => 'Example Sortable',
  'fields' => array(
    array(
      'id' => 'test-text-1',
      'type' => 'text',
      'title' => 'Text',
    ),
    array(
      'id' => 'test-text-2',
      'type' => 'text',
      'title' => 'Text Two',
    ),
    array(
      'id' => 'test-text-3',
      'type' => 'text',
      'title' => 'Text Three',
    ),
  ),
  'default' => array(
    'test-text-1' => 'This is Default Text',
    'test-text-2' => 'This is more default text',
    'test-text-3' => 'This is even more default text',
  ),
),
Was this article helpful to you? Yes No

How can we help?