PHP Class Carbon_Fields\Widget\Widget

Inheritance: extends WP_Widget, implements Carbon_Fields\Datastore\Datastore_Interface
Show file Open project: htmlburger/carbon-fields

Public Properties

Property Type Description
$registered_widget_ids

Protected Properties

Property Type Description
$complex_field_names
$custom_fields
$form_options
$print_wrappers
$store_data

Public Methods

Method Description
add_fields ( array $fields ) Append array of fields to the current fields set. All items of the array must be instances of Field and their names should be unique for all Carbon containers.
delete ( Field $field ) Delete the field value(s) from the database.
delete_values ( mixed $field ) Delete complex field value(s) from the database.
form ( array $instance ) Outputs the settings update form.
front_end ( array $args, array $instance ) The actual content of the widget.
load ( Field $field ) Load the field value(s) from the database.
load_values ( mixed $field ) Load complex field value(s) from the database.
save ( Field $field ) Save the field value(s) into the database.
setup ( string $title, string $description, array $fields, string $classname = '' ) Create the widget.
unwrap_complex_field_values ( $instance, $complex_field_names ) Expand complex fields from raw data.
update ( array $new_instance, array $old_instance ) : array Updates a particular instance of a widget.
verify_unique_field_name ( string $name ) Verify widget field names are unique.
verify_unique_widget_id ( string $id ) Verify widget IDs are unique.
widget ( array $args, array $instance ) Echoes the widget content.

Method Details

add_fields() public method

Append array of fields to the current fields set. All items of the array must be instances of Field and their names should be unique for all Carbon containers.
public add_fields ( array $fields )
$fields array

delete() public method

Delete the field value(s) from the database.
public delete ( Field $field )
$field Carbon_Fields\Field\Field The field to delete.

delete_values() public method

Delete complex field value(s) from the database.
public delete_values ( mixed $field )
$field mixed The field to delete values for.

form() public method

Outputs the settings update form.
public form ( array $instance )
$instance array Current settings.

front_end() public method

Generally should be overriden by the specific widget classes.
public front_end ( array $args, array $instance )
$args array Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
$instance array The settings for the particular instance of the widget.

load() public method

Load the field value(s) from the database.
public load ( Field $field )
$field Carbon_Fields\Field\Field The field to retrieve value for.

load_values() public method

Load complex field value(s) from the database.
public load_values ( mixed $field )
$field mixed The field to load values for.

save() public method

Save the field value(s) into the database.
public save ( Field $field )
$field Carbon_Fields\Field\Field The field to save.

setup() public method

A wrapper around the default WP widget constructor.
public setup ( string $title, string $description, array $fields, string $classname = '' )
$title string Widget name
$description string Widget description
$fields array Array of fields
$classname string String of CSS classes

unwrap_complex_field_values() public static method

Expand complex fields from raw data.
public static unwrap_complex_field_values ( $instance, $complex_field_names )

update() public method

Updates a particular instance of a widget.
public update ( array $new_instance, array $old_instance ) : array
$new_instance array New settings for this instance as input by the user via WP_Widget::form().
$old_instance array Old settings for this instance.
return array Settings to save or bool false to cancel saving.

verify_unique_field_name() public method

Verify widget field names are unique.
public verify_unique_field_name ( string $name )
$name string Field name

verify_unique_widget_id() public method

Verify widget IDs are unique.
public verify_unique_widget_id ( string $id )
$id string Widget ID

widget() public method

Sub-classes can over-ride this method to generate their widget code but it is best to override front_end().
public widget ( array $args, array $instance )
$args array Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
$instance array The settings for the particular instance of the widget.

Property Details

$complex_field_names protected property

protected $complex_field_names

$custom_fields protected property

protected $custom_fields

$form_options protected property

protected $form_options

$print_wrappers protected property

protected $print_wrappers

$registered_widget_ids public static property

public static $registered_widget_ids

$store_data protected property

protected $store_data