Attributes
Name | Type | Default | Description |
---|---|---|---|
id | string | A unique ID. This ID will be used to get the value | |
type | string | number | Type of the 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) of 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 | |||
unit | string | px | The unit to display of the field, also sets output CSS property unit value |
output | array|string | CSS elements selector | |
output_mode | string | width | Output CSS property of an element. for( width height max-width ) |
output_important | bool | false | Flag to add !important rule on output css |
Simple Number Field Example
array(
'id' => 'example-number',
'type' => 'number',
'title' => 'Number Example',
),
Number Field Example with Default
array(
'id' => 'example-number',
'type' => 'number',
'title' => 'Number Example',
'default' => 50,
),
Number Field Example with Output
array(
'id' => 'example-number',
'type' => 'number',
'title' => 'Number Example',
'unit' => '%',
'output' => '.header-area',
'output_mode' => 'width',
'default' => 100,
),