sortable(sample)

Display a vertical sortable values.

Option Details & Parameters

Type: sortable

Returns: array

Can be placed in: Admin Panels , Admin Tabs , Meta Boxes , Theme Customizer

Parameter Type Description
name string The name of the option, for display purposes only.
id string A unique ID for this option. This ID will be used to get the value for this option.
desc string The description to display together with this option.
options array (Optional) An array of value and label pairs to display in the sortable field.
default string (Optional) An array of visible values. If visible_button is set to false and you provide a default value here, visible_button will automatically be set to true. Use the options parameter to list the initial order of the values.
visible_button boolean (Optional) If true, the sortable values can be toggled to be hidden. If false, the button will not be shown. Defaults to true

Return Value

When getting the value of this option, you will get an array containing the values (the keys of the option parameter) with the ordering saved in the admin. Values which are toggled to be hidden in the sortable field will not be included in the array.

Settings / Parameters

Creating a sortable option:

$panel->createOption( array(
'name' => 'My Sortable Option',
'id' => 'my_sortable_option',
'type' => 'sortable',
'desc' => 'This is our option',
'options' => array(
'value1' => 'The first label',
'value2' => 'The second label',
'value3' => 'The third label',
'value4' => 'The fourth label',
)
) );