PHP Class Carbon_Fields\Field\Complex_Field

Allows nested repeaters with multiple field groups to be created.
Inheritance: extends Field
Show file Open project: htmlburger/carbon-fields

Public Properties

Property Type Description
$labels

Protected Properties

Property Type Description
$fields
$groups
$layout
$values
$values_max
$values_min

Public Methods

Method Description
add_fields ( ) Add a set/group of fields.
delete ( ) Delete the values of all contained fields.
get_fields ( ) : array Retrieve all groups of fields.
get_group_by_name ( string $group_name ) : Group_Field Retrieve a group by its name.
get_group_names ( ) : array Retrieve the groups of this field.
get_max ( ) : integer Get the maximum number of entries.
get_min ( ) : integer Get the minimum number of entries.
get_values ( ) : array Retrieve the field values.
init ( ) Initialization tasks.
load ( ) Load all groups of fields and their data.
load_values ( ) Load and parse the field data.
load_values_from_array ( array $values ) : array Load and parse a raw set of field data.
load_values_from_db ( ) Load and parse the field data from the database.
process_loaded_values ( array $group_rows ) Parse groups of raw field data into the actual field hierarchy.
save ( ) Save all contained groups of fields.
set_datastore ( Carbon_Fields\Datastore\Datastore_Interface $store ) Set the datastore of this field.
set_header_template ( string | callable $template ) Set the group label Underscore template.
set_layout ( string $layout ) Modify the layout of this field.
set_max ( integer $max ) Set the maximum number of entries.
set_min ( integer $min ) Set the minimum number of entries.
set_prefix ( string $prefix ) Generate and set the field prefix.
set_value_from_input ( array $input = null ) Load the field value from an input array based on it's name.
setup_labels ( array $labels ) Set the field labels.
template ( ) The main Underscore template.
template_group ( ) The Underscore template for the complex field group.
template_group_tab_item ( ) The Underscore template for the group item tab.
to_json ( boolean $load ) : array Returns an array that holds the field data, suitable for JSON representation.

Method Details

add_fields() public method

Add a set/group of fields.
public add_fields ( )

delete() public method

Delete the values of all contained fields.
public delete ( )

get_fields() public method

Retrieve all groups of fields.
public get_fields ( ) : array
return array $fields

get_group_by_name() public method

Retrieve a group by its name.
public get_group_by_name ( string $group_name ) : Group_Field
$group_name string Group name
return Group_Field $group_object Group object

get_group_names() public method

Retrieve the groups of this field.
public get_group_names ( ) : array
return array

get_max() public method

Get the maximum number of entries.
public get_max ( ) : integer
return integer $max

get_min() public method

Get the minimum number of entries.
public get_min ( ) : integer
return integer $min

get_values() public method

Retrieve the field values.
public get_values ( ) : array
return array

init() public method

Initialization tasks.
public init ( )

load() public method

Load all groups of fields and their data.
public load ( )

load_values() public method

Load and parse the field data.
public load_values ( )

load_values_from_array() public method

Load and parse a raw set of field data.
public load_values_from_array ( array $values ) : array
$values array Raw data entries
return array Processed data entries

load_values_from_db() public method

Load and parse the field data from the database.
public load_values_from_db ( )

process_loaded_values() public method

Parse groups of raw field data into the actual field hierarchy.
public process_loaded_values ( array $group_rows )
$group_rows array Group rows

save() public method

Save all contained groups of fields.
public save ( )

set_datastore() public method

Set the datastore of this field.
public set_datastore ( Carbon_Fields\Datastore\Datastore_Interface $store )
$store Carbon_Fields\Datastore\Datastore_Interface

set_header_template() public method

Set the group label Underscore template.
public set_header_template ( string | callable $template )
$template string | callable

set_layout() public method

Modify the layout of this field.
public set_layout ( string $layout )
$layout string

set_max() public method

Set the maximum number of entries.
public set_max ( integer $max )
$max integer

set_min() public method

Set the minimum number of entries.
public set_min ( integer $min )
$min integer

set_prefix() public method

Generate and set the field prefix.
public set_prefix ( string $prefix )
$prefix string

set_value_from_input() public method

Load the field value from an input array based on it's name.
public set_value_from_input ( array $input = null )
$input array (optional) Array of field names and values. Defaults to $_POST

setup_labels() public method

Currently supported values: - singular_name - the singular entry label - plural_name - the plural entries label
public setup_labels ( array $labels )
$labels array Labels

template() public method

The main Underscore template.
public template ( )

template_group() public method

The Underscore template for the complex field group.
public template_group ( )

template_group_tab_item() public method

The Underscore template for the group item tab.

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

Property Details

$fields protected property

protected $fields

$groups protected property

protected $groups

$labels public property

public $labels

$layout protected property

protected $layout

$values protected property

protected $values

$values_max protected property

protected $values_max

$values_min protected property

protected $values_min