Skip to content
Radoslav Georgiev edited this page Oct 21, 2018 · 3 revisions

Purpose

The Number field uses an HTML 5 number input. Additionally, a jQuery UI slider can be enabled.

number-field

Settings

Minimum / Maximum

You can adjust the minimum and maximum attributes of the field. Those will apply to both the <input type="number" /> element, as well as the slider when it is enabled.

In the interface, use the "Minimum" and "Maximum" settings.

In PHP, use the set_minimum and set_maximum methods:

Field::create( 'number', 'columns' )
	->set_minimum( 1 )
	->set_maximum( 3 )

Step

Just like the minimum and maximum attribute, you can adjust the step of the number field:

Field::create( 'number', 'animation_speed', 'Animation speed (ms)' )
	->set_default_value( 600 )
	->set_step( 100 )

Slider

Enabling the jQuery UI Slider requires a minumum and maximum value to be set.

In the UI, set the min/max and check the "Enable Slider" checkbox.

In PHP, use the enable_slider( $minimum, $maximum, $step = 1 ) method. You may skip the step:

Field::create( 'number', 'animation_speed' )
	->enable_slider( 200, 1200, 100 )

Usage

All API Functions will return/display a number.

Clone this wiki locally