PHP Class Carbon_Fields\Field\Group_Field

Show file Open project: htmlburger/carbon-fields Class Usage Examples

Protected Properties

Property Type Description
$fields array Group fields.
$group_id string Unique group identificator. Generated randomly.
$label string Group label, used during rendering.
$label_template string Group label underscore template.
$name string Sanitized group name.
$registered_field_names array List of registered unique field names

Public Methods

Method Description
__construct ( string $name, string $label, array $fields ) Create a group field with the specified name and label.
add_fields ( array $fields ) Add a group of fields.
get_field_names ( ) : array Return the names of all fields.
get_fields ( ) : array Fields attribute getter.
get_group_id ( ) : string Group ID attribute getter.
get_label ( ) : string Label attribute getter.
get_label_template ( ) : string Set the Underscore label template.
get_name ( ) : string Return the group name.
set_datastore ( Carbon_Fields\Datastore\Datastore_Interface $store ) Assign a DataStore instance for all group fields.
set_label ( string $label ) Set the group label.
set_label_template ( string $template ) Set the Underscore label template.
set_name ( string $name ) Set the group name.
set_prefix ( string $prefix ) Set a prefix for all group fields.
template_label ( ) Print the label Underscore template.
to_json ( boolean $load ) : array Returns an array that holds the field data, suitable for JSON representation.
verify_unique_field_name ( string $name ) Perform checks whether there is a field registered with the name $name.

Method Details

__construct() public method

Create a group field with the specified name and label.
public __construct ( string $name, string $label, array $fields )
$name string
$label string
$fields array

add_fields() public method

Add a group of fields.
public add_fields ( array $fields )
$fields array

get_field_names() public method

Return the names of all fields.
public get_field_names ( ) : array
return array

get_fields() public method

Fields attribute getter.
public get_fields ( ) : array
return array

get_group_id() public method

Group ID attribute getter.
public get_group_id ( ) : string
return string

get_label() public method

Label attribute getter.
public get_label ( ) : string
return string

get_label_template() public method

Set the Underscore label template.
public get_label_template ( ) : string
return string

get_name() public method

Return the group name.
public get_name ( ) : string
return string

set_datastore() public method

Assign a DataStore instance for all group fields.
public set_datastore ( Carbon_Fields\Datastore\Datastore_Interface $store )
$store Carbon_Fields\Datastore\Datastore_Interface

set_label() public method

Set the group label.
public set_label ( string $label )
$label string If null, the label will be generated from the group name

set_label_template() public method

Set the Underscore label template.
public set_label_template ( string $template )
$template string

set_name() public method

Set the group name.
public set_name ( string $name )
$name string Group name, either sanitized or not

set_prefix() public method

Set a prefix for all group fields.
public set_prefix ( string $prefix )
$prefix string

template_label() public method

Print the label Underscore template.
public template_label ( )

to_json() public method

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.
return array

verify_unique_field_name() public method

If not, the field name is recorded.
public verify_unique_field_name ( string $name )
$name string

Property Details

$fields protected property

Group fields.
protected array $fields
return array

$group_id protected property

Unique group identificator. Generated randomly.
protected string $group_id
return string

$label protected property

Group label, used during rendering.
protected string $label
return string

$label_template protected property

Group label underscore template.
protected string $label_template
return string

$name protected property

Sanitized group name.
protected string $name
return string

$registered_field_names protected property

List of registered unique field names
See also: verify_unique_field_name()
protected array $registered_field_names
return array