Arguments
Name | Type | Default | Description |
---|
id | string | | A unique ID. This ID will be used to get the value |
type | string | spacing | Type of field |
title | string | | Title of the field |
default | array | | Default value from database, if the option doesn’t exist |
subtitle | string | | Subtitle to display below the title |
desc | string | | Description to display after the field |
help | string | | Text to display on right-corner (as hover/popup) the field |
class | string | | Extra CSS classes (space separated) to append to the field |
before | string | | Content to display before the field |
after | string | | Content to display after the field |
dependency | array | | Define field visibility depending on other field value |
attributes | array | | Extra HTML attributes to append to the field |
sanitize | string | | Callback function for sanitizing value |
validate | string | | Callback function for validating value |
EXTRAS | | | |
top_icon | string | top-icon | The icon/text to display on the border top field |
right_icon | string | right-icon | The icon/text to display on the border right field |
bottom_icon | string | bottom-icon | The icon/text to display on the border bottom field |
left_icon | string | left-icon | The icon/text to display on the border left field |
all_icon | string | all-icon | The icon/text to display on the border all corners field |
top | bool | true | Flag to display top of the field |
right | bool | true | Flag to display right of the field |
bottom | bool | true | Flag to display bottom of the field |
left | bool | true | Flag to display left of the field |
all | bool | false | Flag to display all corners of the field |
show_units | bool | true | Flag to display unit selector of the field |
units | array | | The CSS measurement units (px em % cm pt) |
output | array|string | | CSS elements selector |
output_mode | string | padding | Output CSS property of an element (relative padding margin) |
output_important | bool | false | Flag to add !important rule on output css |
Default Arguments
Name | Type | Description |
---|
top | number | Numeric representing the default top field value |
left | number | Numeric representing the default left field value |
bottom | number | Numeric representing the default bottom field value |
right | number | Numeric representing the default right field value |
all | number | Numeric representing the default all field value |
unit | string | String representing the default unit value (px em %) |
Simple Spacing Field Example
array(
'id' => 'example-spacing',
'type' => 'spacing',
'title' => 'Example Spacing',
),
Spacing Field Example with Defaults
array(
'id' => 'example-spacing',
'type' => 'spacing',
'title' => 'Example Spacing',
'default' => array(
'top' => '50',
'right' => '100',
'bottom' => '50',
'left' => '100',
'unit' => 'px',
),
),
Spacing Field Example with Specifics
array(
'id' => 'example-spacing',
'type' => 'spacing',
'title' => 'Example Spacing',
'left' => false,
'right' => false,
'units' => array('px'),
),
Spacing Field Example with Output
array(
'id' => 'example-spacing',
'type' => 'spacing',
'title' => 'Example Spacing',
'output' => '.heading-area',
'output_mode' => 'padding',
'default' => array(
'top' => '10',
'right' => '20',
'bottom' => '10',
'left' => '20',
'unit' => 'px',
),
),
Was this article helpful to you?
Yes
No