Property | Type | Description | |
---|---|---|---|
$type | string | Stores the initial $type variable passed to the factory() method |
Property | Type | Description | |
---|---|---|---|
$autoload | boolean | Whether or not this value should be auto loaded. Applicable to theme options only. | |
$base_name | string | The base field name which is used in the container. | |
$classes | array | Custom CSS classes. | |
$conditional_logic | array | Stores the field conditional logic rules. | |
$context | string | The type of the container this field is in | |
$default_value | mixed | Default field value | |
$help_text | string | Additional text containing information and guidance for the user | |
$id | string | Globally unique field identificator. Generated randomly | |
$label | string | Field name used as label during field render | |
$lazyload | boolean | Whether or not this field will be initialized when the field is in the viewport (visible). | |
$name | string | Sanitized field name used as input name attribute during field render | |
$name_prefix | string | Prefix to be prepended to the field name during load, save, delete and render | |
$required | boolean | Whether or not this field is required. | |
$store | Carbon_Fields\Datastore\Datastore_Interface | Field DataStore instance to which save, load and delete calls are delegated | |
$templates | array | Stores all the field Backbone templates | |
$value | mixed | Field value | |
$width | integer | The width of the field. |
Method | Description | |
---|---|---|
add_class ( string | array $classes ) : object | Add custom CSS class to the field html container. | |
add_template ( $name, $callback ) | Adds a new Backbone template | |
admin_enqueue_scripts ( ) | Enqueue admin scripts. | |
admin_hook_scripts ( ) | Hook administration scripts. | |
admin_hook_styles ( ) | Hook administration styles. | |
admin_init ( ) | Instance initialization when in the admin area. | |
boot ( ) | Boot the field once the container is attached. | |
delete ( ) | Delegate delete to the field DataStore instance | |
factory ( string $type, string $name, string $label = null ) : object | Create a new field of type $type and name $name and label $label. | |
get_autoload ( ) : boolean | Return whether or not this value should be auto loaded. | |
get_base_name ( ) : string | Return the field base name. | |
get_classes ( ) : array | Get the field custom CSS classes. | |
get_conditional_logic ( ) : array | Get the conditional logic rules | |
get_context ( ) : string | Return the type of the container this field is in | |
get_datastore ( ) : object | Return the DataStore instance used by the field | |
get_default_value ( ) : mixed | Get default field value | |
get_help_text ( ) : object | Return the field help text | |
get_html_class ( ) : array | Return an array of html classes to be used for the field container | |
get_id ( ) : string | HTML id attribute getter. | |
get_label ( ) : string | Return field label. | |
get_lazyload ( ) : boolean | Return whether or not this field should be lazyloaded. | |
get_name ( ) : string | Return the field name | |
get_templates ( ) : array | Returns all the Backbone templates | |
get_type ( ) : string | Returns the type of the field based on the class. | |
get_value ( ) : mixed | Return the field value | |
get_width ( ) : integer | Get the field width. | |
help_text ( $help_text ) : object | Alias for set_help_text() | |
init ( ) | Perform instance initialization after calling setup() | |
is_required ( ) : boolean | Return whether this field is mandatory for the user | |
load ( ) | Delegate load to the field DataStore instance | |
make ( $type, $name, $label = null ) | An alias of factory(). | |
process_value ( ) : array | Allows the value of a field to be processed after loading. | |
save ( ) | Delegate save to the field DataStore instance | |
set_autoload ( boolean $autoload ) : object | Whether or not this value should be auto loaded. Applicable to theme options only. | |
set_base_name ( $name ) | Set field base name as defined in the container. | |
set_conditional_logic ( $rules ) | Set the field visibility conditional logic. | |
set_context ( $context ) : object | Assign the type of the container this field is in | |
set_datastore ( Carbon_Fields\Datastore\Datastore_Interface $store ) : object | Assign DataStore instance for use during load, save and delete | |
set_default_value ( mixed $default_value ) | Set default field value | |
set_help_text ( $help_text ) : object | Set additional text to be displayed during field render, containing information and guidance for the user | |
set_id ( string $id ) | HTML id attribute setter | |
set_label ( string $label ) | Set field label. | |
set_lazyload ( boolean $lazyload ) : object | Whether or not this field will be initialized when the field is in the viewport (visible). | |
set_name ( string $name ) | Set field name. | |
set_prefix ( string $prefix ) : object | Set field name prefix. Calling this method will update the current field name and the conditional logic fields. | |
set_required ( boolean $required ) : object | Whether this field is mandatory for the user | |
set_value ( mixed $value ) | Directly modify the field value | |
set_value_from_input ( array $input = null ) | Load the field value from an input array based on it's name | |
set_width ( integer $width ) : object | Set the field width. | |
template ( ) | Prints the main Underscore template | |
to_json ( boolean $load ) : array | Returns an array that holds the field data, suitable for JSON representation. |
Method | Description | |
---|---|---|
__construct ( string $name, string $label ) | Create a field from a certain type with the specified label. | |
clean_type ( $type ) : string | Cleans up an object class for usage as HTML class | |
parse_conditional_rules ( array $rules ) : array | Validate and parse the conditional logic rules. |
protected __construct ( string $name, string $label ) | ||
$name | string | Field name |
$label | string | Field label |
public static admin_enqueue_scripts ( ) |
public static admin_hook_scripts ( ) |
public static admin_hook_styles ( ) |
protected clean_type ( $type ) : string | ||
return | string |
public get_autoload ( ) : boolean | ||
return | boolean |
public get_base_name ( ) : string | ||
return | string |
public get_classes ( ) : array | ||
return | array |
public get_conditional_logic ( ) : array | ||
return | array |
public get_context ( ) : string | ||
return | string |
public get_datastore ( ) : object | ||
return | object | $store |
public get_default_value ( ) : mixed | ||
return | mixed |
public get_help_text ( ) : object | ||
return | object | $this |
public get_html_class ( ) : array | ||
return | array |
public get_lazyload ( ) : boolean | ||
return | boolean |
public get_templates ( ) : array | ||
return | array |
public is_required ( ) : boolean | ||
return | boolean |
public static make ( $type, $name, $label = null ) |
protected parse_conditional_rules ( array $rules ) : array | ||
$rules | array | |
return | array |
public process_value ( ) : array | ||
return | array |
public set_autoload ( boolean $autoload ) : object | ||
$autoload | boolean | |
return | object | $this |
public set_base_name ( $name ) |
public set_conditional_logic ( $rules ) |
public set_context ( $context ) : object | ||
return | object | $this |
public set_datastore ( Carbon_Fields\Datastore\Datastore_Interface $store ) : object | ||
$store | Carbon_Fields\Datastore\Datastore_Interface | |
return | object | $this |
public set_default_value ( mixed $default_value ) | ||
$default_value | mixed |
public set_help_text ( $help_text ) : object | ||
return | object | $this |
public set_lazyload ( boolean $lazyload ) : object | ||
$lazyload | boolean | |
return | object | $this |
public set_prefix ( string $prefix ) : object | ||
$prefix | string | |
return | object | $this |
public set_required ( boolean $required ) : object | ||
$required | boolean | |
return | object | $this |
public set_value_from_input ( array $input = null ) | ||
$input | array | (optional) Array of field names and values. Defaults to $_POST |
protected bool $autoload | ||
return | boolean |
protected string $base_name | ||
return | string |
protected array $conditional_logic | ||
return | array |
protected string $context | ||
return | string |
protected string $help_text | ||
return | string |
protected string $id | ||
return | string |
protected string $label | ||
return | string |
protected bool $lazyload | ||
return | boolean |
protected string $name | ||
return | string |
protected string $name_prefix | ||
return | string |
protected bool $required | ||
return | boolean |
protected Datastore_Interface,Carbon_Fields\Datastore $store | ||
return | Carbon_Fields\Datastore\Datastore_Interface |
protected array $templates | ||
return | array |
factory()
method public string $type | ||
return | string |