PHP Class Carbon_Fields\Field\Predefined_Options_Field

Mainly used to reduce the bloat on the base Field class.
Inheritance: extends Field
Show file Open project: htmlburger/carbon-fields

Protected Properties

Property Type Description
$options array | callable Stores the field options (if any)

Public Methods

Method Description
add_options ( array | callable $options ) Add new options to this field.
get_options ( ) : array | callable Retrieve the current options.
parse_options ( array | callable $options ) : array Changes the options array structure. This is needed to keep the array items order when it is JSON encoded.
set_options ( array | callable $options ) Set the options of this field.

Protected Methods

Method Description
load_options ( ) Check if there are callbacks and populate the options

Method Details

add_options() public method

Accepts an array of data.
public add_options ( array | callable $options )
$options array | callable

get_options() public method

Retrieve the current options.
public get_options ( ) : array | callable
return array | callable $options

load_options() protected method

Check if there are callbacks and populate the options
protected load_options ( )

parse_options() public method

Will also work with a callable that returns an array.
public parse_options ( array | callable $options ) : array
$options array | callable
return array

set_options() public method

Accepts either array of data or a callback that returns the data.
public set_options ( array | callable $options )
$options array | callable

Property Details

$options protected property

Stores the field options (if any)
protected array|callable $options
return array | callable