PHP Class Carbon_Fields\Field\Checkbox_Field

Inheritance: extends Field
Afficher le fichier Open project: htmlburger/carbon-fields

Protected Properties

Свойство Type Description
$option_value string The value that is saved in the database when this checkbox field is enabled.

Méthodes publiques

Méthode Description
get_label ( ) : string Get the field label.
is_required ( ) : boolean Whether this field is required.
set_option_value ( string $value ) Modify the option value.
set_value_from_input ( array $input = null ) Load the field value from an input array based on it's name.
template ( ) Underscore template of the field.
to_json ( boolean $load ) : array Returns an array that holds the field data, suitable for JSON representation.

Method Details

get_label() public méthode

Label here is empty because it is displayed in the Underscore template.
public get_label ( ) : string
Résultat string Label of the field.

is_required() public méthode

A single checkbox field is non-required by design.
public is_required ( ) : boolean
Résultat boolean false

set_option_value() public méthode

Modify the option value.
public set_option_value ( string $value )
$value string New value

set_value_from_input() public méthode

If not enabled, set to empty string for easier data querying.
public set_value_from_input ( array $input = null )
$input array (optional) Array of field names and values. Defaults to $_POST

template() public méthode

Underscore template of the field.
public template ( )

to_json() public méthode

In addition to default data, option value and label are added. This data will be available in the Underscore template and the Backbone Model.
public to_json ( boolean $load ) : array
$load boolean Should the value be loaded from the database or use the value from the current instance.
Résultat array

Property Details

$option_value protected_oe property

The value that is saved in the database when this checkbox field is enabled.
protected string $option_value
Résultat string