PHP 클래스 Carbon_Fields\Container\Container

Defines the key container methods and their default implementations.
파일 보기 프로젝트 열기: htmlburger/carbon-fields 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$active_containers array List of containers attached to the current page view
$registered_panel_ids array List of registered unique panel identificators
$settings array List of default container settings
$setup_ready boolean Whether the container was setup
$title string Title of the container

보호된 프로퍼티들

프로퍼티 타입 설명
$active_fields array List of fields attached to the current page view
$errors array List of error messages to be displayed on the front-end
$fields array List of container fields
$init_containers array List of containers created via factory that should be initialized
$notifications array List of notification messages to be displayed on the front-end
$registered_field_names array List of registered unique field names for this container instance
$store object Container DataStore. Propagated to all container fields
$tabs Tabs available
$templates array Stores all the container Backbone templates

공개 메소드들

메소드 설명
__construct ( string $title ) Create a new container
_attach ( ) Called first as part of the container attachment procedure.
_save ( ) Called first as part of the container save procedure.
activate_container ( $container ) Adds a container to the active containers array and triggers an action
activate_field ( $field ) Adds a field to the active fields array and triggers an action
add_fields ( array $fields ) : object 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.
add_tab ( string $tab_name, array $fields ) : object Configuration function for adding tab with fields
add_template ( $name, $callback ) Adds a new Backbone template
admin_hook_scripts ( ) Enqueue admin scripts
admin_hook_styles ( ) Enqueue admin styles
attach ( ) Attach the container rendering and helping methods to concrete WordPress Action hooks
boot ( ) Boot the container once it's attached.
check_setup_settings ( array &$settings = [] ) Check if all required container settings have been specified
detach ( ) Revert the result of attach()
drop_unique_field_name ( string $name ) Remove field name $name from the list of unique field names
drop_unique_panel_id ( string $id ) Remove container identificator $id from the list of unique container ids
factory ( string $type, string $name ) : object Create a new container of type $type and name $name and label $label.
get_active_containers ( ) : array Returns all the active containers created via factory
get_active_fields ( ) : array Returns all the active fields created via factory
get_datastore ( ) : object Return the DataStore instance used by container fields
get_fields ( ) : array Returns the private container array of fields.
get_nonce_field ( ) : string Return WordPress nonce field
get_nonce_name ( ) : string Return WordPress nonce name used to identify the current container instance
get_tabs ( ) : array Retrieve all tabs.
get_tabs_json ( ) : array Build the tabs JSON
get_templates ( ) : array Returns all the Backbone templates
get_untabbed_fields ( ) : array Retrieve all fields that are not defined under a specific tab
has_fields ( ) : boolean Perform a check whether the current container has fields
init ( ) Perform instance initialization after calling setup()
init_containers ( ) : object Initialize containers created via factory
is_active ( ) : boolean Perform checks whether the container is active for current request
is_tabbed ( ) : boolean Whether the container is tabbed or not
is_valid_attach ( ) : boolean Perform checks whether the container should be attached during the current request
is_valid_save ( ) : boolean Checks whether the current request is valid
load ( ) Load the value for each field in the container.
make ( $type, $name ) An alias of factory().
save ( $data ) Load submitted data and save each field in the container
set_datastore ( object $store ) : object Assign DataStore instance for use by the container fields
setup ( array $settings = [] ) : object Update container settings and begin initialization
template ( ) Prints the container Underscore template
template_tabs ( ) Underscore template for tabs
to_json ( boolean $load ) : array Returns an array that holds the container data, suitable for JSON representation.
verify_unique_field_name ( string $name ) Perform checks whether there is a field registered with the name $name.
verify_unique_panel_id ( $id ) Perform checks whether there is a container registered with identificator $id

비공개 메소드들

메소드 설명
create_tab ( string $tab_name, array $fields, integer $queue_end = self::TABS_TAIL ) : object Internal function that creates the tab and associates it with particular field set

메소드 상세

__construct() 공개 메소드

Create a new container
public __construct ( string $title )
$title string Unique title of the container

_attach() 공개 메소드

Responsible for checking it's OK to attach the container and if it is, calling the container-specific attach() method
또한 보기: attach()
또한 보기: is_valid_attach()
public _attach ( )

_save() 공개 메소드

Responsible for checking the request validity and calling the container-specific save() method
또한 보기: save()
또한 보기: is_valid_save()
public _save ( )

activate_container() 공개 정적인 메소드

Adds a container to the active containers array and triggers an action
public static activate_container ( $container )

activate_field() 공개 정적인 메소드

Adds a field to the active fields array and triggers an action
public static activate_field ( $field )

add_fields() 공개 메소드

If a field does not have DataStore already, the container data store is assigned to them instead.
public add_fields ( array $fields ) : object
$fields array
리턴 object $this

add_tab() 공개 메소드

Configuration function for adding tab with fields
public add_tab ( string $tab_name, array $fields ) : object
$tab_name string
$fields array
리턴 object $this

add_template() 공개 메소드

Adds a new Backbone template
public add_template ( $name, $callback )

admin_hook_scripts() 공개 정적인 메소드

Enqueue admin scripts
public static admin_hook_scripts ( )

admin_hook_styles() 공개 정적인 메소드

Enqueue admin styles
public static admin_hook_styles ( )

attach() 공개 메소드

Attach the container rendering and helping methods to concrete WordPress Action hooks
public attach ( )

boot() 공개 메소드

Boot the container once it's attached.
public boot ( )

check_setup_settings() 공개 메소드

Check if all required container settings have been specified
public check_setup_settings ( array &$settings = [] )
$settings array Container settings

detach() 공개 메소드

Revert the result of attach()
public detach ( )

drop_unique_field_name() 공개 메소드

Remove field name $name from the list of unique field names
public drop_unique_field_name ( string $name )
$name string

drop_unique_panel_id() 공개 정적인 메소드

Remove container identificator $id from the list of unique container ids
public static drop_unique_panel_id ( string $id )
$id string

factory() 공개 정적인 메소드

Create a new container of type $type and name $name and label $label.
public static factory ( string $type, string $name ) : object
$type string
$name string Human-readable name of the container
리턴 object $container

get_active_containers() 공개 정적인 메소드

Returns all the active containers created via factory
public static get_active_containers ( ) : array
리턴 array

get_active_fields() 공개 정적인 메소드

Returns all the active fields created via factory
public static get_active_fields ( ) : array
리턴 array

get_datastore() 공개 메소드

Return the DataStore instance used by container fields
public get_datastore ( ) : object
리턴 object $store

get_fields() 공개 메소드

Use only if you are completely aware of what you are doing.
public get_fields ( ) : array
리턴 array

get_nonce_field() 공개 메소드

Return WordPress nonce field
public get_nonce_field ( ) : string
리턴 string

get_nonce_name() 공개 메소드

Return WordPress nonce name used to identify the current container instance
public get_nonce_name ( ) : string
리턴 string

get_tabs() 공개 메소드

Create a default tab if there are any untabbed fields.
public get_tabs ( ) : array
리턴 array

get_tabs_json() 공개 메소드

Build the tabs JSON
public get_tabs_json ( ) : array
리턴 array

get_templates() 공개 메소드

Returns all the Backbone templates
public get_templates ( ) : array
리턴 array

get_untabbed_fields() 공개 메소드

Retrieve all fields that are not defined under a specific tab
public get_untabbed_fields ( ) : array
리턴 array

has_fields() 공개 메소드

Perform a check whether the current container has fields
public has_fields ( ) : boolean
리턴 boolean

init() 추상적인 공개 메소드

Perform instance initialization after calling setup()
abstract public init ( )

init_containers() 공개 정적인 메소드

Initialize containers created via factory
public static init_containers ( ) : object
리턴 object

is_active() 공개 메소드

Perform checks whether the container is active for current request
public is_active ( ) : boolean
리턴 boolean True if the container is active

is_tabbed() 공개 메소드

Whether the container is tabbed or not
public is_tabbed ( ) : boolean
리턴 boolean

is_valid_attach() 공개 메소드

Perform checks whether the container should be attached during the current request
public is_valid_attach ( ) : boolean
리턴 boolean True if the container is allowed to be attached

is_valid_save() 공개 메소드

Checks whether the current request is valid
public is_valid_save ( ) : boolean
리턴 boolean

load() 공개 메소드

Could be used internally during container rendering
public load ( )

make() 공개 정적인 메소드

An alias of factory().
또한 보기: Container::factory()
public static make ( $type, $name )

save() 공개 메소드

Load submitted data and save each field in the container
또한 보기: is_valid_save()
public save ( $data )

set_datastore() 공개 메소드

Assign DataStore instance for use by the container fields
public set_datastore ( object $store ) : object
$store object
리턴 object $this

setup() 공개 메소드

Update container settings and begin initialization
또한 보기: init()
public setup ( array $settings = [] ) : object
$settings array
리턴 object $this

template() 공개 메소드

Prints the container Underscore template
public template ( )

template_tabs() 공개 메소드

Underscore template for tabs
public template_tabs ( )

to_json() 공개 메소드

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.
리턴 array

verify_unique_field_name() 공개 메소드

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

verify_unique_panel_id() 공개 정적인 메소드

Perform checks whether there is a container registered with identificator $id
public static verify_unique_panel_id ( $id )

프로퍼티 상세

$active_containers 공개적으로 정적으로 프로퍼티

List of containers attached to the current page view
또한 보기: _attach()
public static array $active_containers
리턴 array

$active_fields 보호되어 있는 정적으로 프로퍼티

List of fields attached to the current page view
또한 보기: _attach()
protected static array $active_fields
리턴 array

$errors 보호되어 있는 프로퍼티

List of error messages to be displayed on the front-end
protected array $errors
리턴 array

$fields 보호되어 있는 프로퍼티

List of container fields
또한 보기: add_fields()
protected array $fields
리턴 array

$init_containers 보호되어 있는 정적으로 프로퍼티

List of containers created via factory that should be initialized
protected static array $init_containers
리턴 array

$notifications 보호되어 있는 프로퍼티

List of notification messages to be displayed on the front-end
protected array $notifications
리턴 array

$registered_field_names 보호되어 있는 프로퍼티

List of registered unique field names for this container instance
또한 보기: verify_unique_field_name()
protected array $registered_field_names
리턴 array

$registered_panel_ids 공개적으로 정적으로 프로퍼티

List of registered unique panel identificators
또한 보기: verify_unique_panel_id()
public static array $registered_panel_ids
리턴 array

$settings 공개적으로 프로퍼티

List of default container settings
또한 보기: init()
public array $settings
리턴 array

$setup_ready 공개적으로 프로퍼티

Whether the container was setup
public bool $setup_ready
리턴 boolean

$store 보호되어 있는 프로퍼티

Container DataStore. Propagated to all container fields
또한 보기: set_datastore()
또한 보기: get_datastore()
protected object $store
리턴 object

$tabs 보호되어 있는 프로퍼티

Tabs available
protected $tabs

$templates 보호되어 있는 프로퍼티

Stores all the container Backbone templates
또한 보기: factory()
또한 보기: add_template()
protected array $templates
리턴 array

$title 공개적으로 프로퍼티

Title of the container
public string $title
리턴 string