PHP 클래스 Carbon_Fields\Field\Field

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

공개 프로퍼티들

프로퍼티 타입 설명
$type string Stores the initial $type variable passed to the factory() method

보호된 프로퍼티들

프로퍼티 타입 설명
$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.

공개 메소드들

메소드 설명
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.

보호된 메소드들

메소드 설명
__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.

메소드 상세

__construct() 보호된 메소드

Create a field from a certain type with the specified label.
protected __construct ( string $name, string $label )
$name string Field name
$label string Field label

add_class() 공개 메소드

Add custom CSS class to the field html container.
public add_class ( string | array $classes ) : object
$classes string | array
리턴 object $this

add_template() 공개 메소드

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

admin_enqueue_scripts() 공개 정적인 메소드

Called once per field type.
public static admin_enqueue_scripts ( )

admin_hook_scripts() 공개 정적인 메소드

Hook administration scripts.
public static admin_hook_scripts ( )

admin_hook_styles() 공개 정적인 메소드

Hook administration styles.
public static admin_hook_styles ( )

admin_init() 공개 메소드

Called during field boot.
public admin_init ( )

boot() 공개 메소드

Boot the field once the container is attached.
public boot ( )

clean_type() 보호된 메소드

Cleans up an object class for usage as HTML class
protected clean_type ( $type ) : string
리턴 string

delete() 공개 메소드

Delegate delete to the field DataStore instance
public delete ( )

factory() 공개 정적인 메소드

Create a new field of type $type and name $name and label $label.
public static factory ( string $type, string $name, string $label = null ) : object
$type string
$name string lower case and underscore-delimited
$label string (optional) Automatically generated from $name if not present
리턴 object $field

get_autoload() 공개 메소드

Return whether or not this value should be auto loaded.
public get_autoload ( ) : boolean
리턴 boolean

get_base_name() 공개 메소드

Return the field base name.
public get_base_name ( ) : string
리턴 string

get_classes() 공개 메소드

Get the field custom CSS classes.
public get_classes ( ) : array
리턴 array

get_conditional_logic() 공개 메소드

Get the conditional logic rules
public get_conditional_logic ( ) : array
리턴 array

get_context() 공개 메소드

Return the type of the container this field is in
public get_context ( ) : string
리턴 string

get_datastore() 공개 메소드

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

get_default_value() 공개 메소드

Get default field value
public get_default_value ( ) : mixed
리턴 mixed

get_help_text() 공개 메소드

Return the field help text
public get_help_text ( ) : object
리턴 object $this

get_html_class() 공개 메소드

Return an array of html classes to be used for the field container
public get_html_class ( ) : array
리턴 array

get_id() 공개 메소드

HTML id attribute getter.
public get_id ( ) : string
리턴 string

get_label() 공개 메소드

Return field label.
public get_label ( ) : string
리턴 string

get_lazyload() 공개 메소드

Return whether or not this field should be lazyloaded.
public get_lazyload ( ) : boolean
리턴 boolean

get_name() 공개 메소드

Return the field name
public get_name ( ) : string
리턴 string

get_templates() 공개 메소드

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

get_type() 공개 메소드

The class is stripped by the "CarbonFields" prefix. Also the "Field" suffix is removed. Then underscores and backslashes are removed.
public get_type ( ) : string
리턴 string

get_value() 공개 메소드

Return the field value
public get_value ( ) : mixed
리턴 mixed

get_width() 공개 메소드

Get the field width.
public get_width ( ) : integer
리턴 integer $width

help_text() 공개 메소드

Alias for set_help_text()
또한 보기: set_help_text()
public help_text ( $help_text ) : object
리턴 object $this

init() 공개 메소드

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

is_required() 공개 메소드

Return whether this field is mandatory for the user
public is_required ( ) : boolean
리턴 boolean

load() 공개 메소드

Delegate load to the field DataStore instance
public load ( )

make() 공개 정적인 메소드

An alias of factory().
또한 보기: Field::factory()
public static make ( $type, $name, $label = null )

parse_conditional_rules() 보호된 메소드

Validate and parse the conditional logic rules.
protected parse_conditional_rules ( array $rules ) : array
$rules array
리턴 array

process_value() 공개 메소드

Can be implemented by the extending class if necessary.
public process_value ( ) : array
리턴 array

save() 공개 메소드

Delegate save to the field DataStore instance
public save ( )

set_autoload() 공개 메소드

Whether or not this value should be auto loaded. Applicable to theme options only.
public set_autoload ( boolean $autoload ) : object
$autoload boolean
리턴 object $this

set_base_name() 공개 메소드

Set field base name as defined in the container.
public set_base_name ( $name )

set_conditional_logic() 공개 메소드

Set the field visibility conditional logic.
public set_conditional_logic ( $rules )

set_context() 공개 메소드

Assign the type of the container this field is in
public set_context ( $context ) : object
리턴 object $this

set_datastore() 공개 메소드

Assign DataStore instance for use during load, save and delete
public set_datastore ( Carbon_Fields\Datastore\Datastore_Interface $store ) : object
$store Carbon_Fields\Datastore\Datastore_Interface
리턴 object $this

set_default_value() 공개 메소드

Set default field value
public set_default_value ( mixed $default_value )
$default_value mixed

set_help_text() 공개 메소드

Set additional text to be displayed during field render, containing information and guidance for the user
public set_help_text ( $help_text ) : object
리턴 object $this

set_id() 공개 메소드

HTML id attribute setter
public set_id ( string $id )
$id string

set_label() 공개 메소드

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

set_lazyload() 공개 메소드

Whether or not this field will be initialized when the field is in the viewport (visible).
public set_lazyload ( boolean $lazyload ) : object
$lazyload boolean
리턴 object $this

set_name() 공개 메소드

Use only if you are completely aware of what you are doing.
public set_name ( string $name )
$name string Field name, either sanitized or not

set_prefix() 공개 메소드

Set field name prefix. Calling this method will update the current field name and the conditional logic fields.
public set_prefix ( string $prefix ) : object
$prefix string
리턴 object $this

set_required() 공개 메소드

Whether this field is mandatory for the user
public set_required ( boolean $required ) : object
$required boolean
리턴 object $this

set_value() 공개 메소드

Directly modify the field value
public set_value ( mixed $value )
$value mixed

set_value_from_input() 공개 메소드

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

set_width() 공개 메소드

Set the field width.
public set_width ( integer $width ) : object
$width integer
리턴 object $this

template() 공개 메소드

Prints the main Underscore template
public template ( )

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

프로퍼티 상세

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

Whether or not this value should be auto loaded. Applicable to theme options only.
또한 보기: set_autoload()
protected bool $autoload
리턴 boolean

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

The base field name which is used in the container.
또한 보기: set_base_name()
protected string $base_name
리턴 string

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

Custom CSS classes.
또한 보기: add_class()
protected array $classes
리턴 array

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

Stores the field conditional logic rules.
protected array $conditional_logic
리턴 array

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

The type of the container this field is in
또한 보기: get_context()
protected string $context
리턴 string

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

Default field value
protected mixed $default_value
리턴 mixed

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

Additional text containing information and guidance for the user
또한 보기: help_text()
protected string $help_text
리턴 string

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

Globally unique field identificator. Generated randomly
protected string $id
리턴 string

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

Field name used as label during field render
또한 보기: factory()
또한 보기: set_label()
protected string $label
리턴 string

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

Whether or not this field will be initialized when the field is in the viewport (visible).
또한 보기: set_lazyload()
protected bool $lazyload
리턴 boolean

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

Sanitized field name used as input name attribute during field render
또한 보기: factory()
또한 보기: set_name()
protected string $name
리턴 string

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

Prefix to be prepended to the field name during load, save, delete and render
protected string $name_prefix
리턴 string

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

Whether or not this field is required.
또한 보기: set_required()
protected bool $required
리턴 boolean

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

Field DataStore instance to which save, load and delete calls are delegated
또한 보기: set_datastore()
또한 보기: get_datastore()
protected Datastore_Interface,Carbon_Fields\Datastore $store
리턴 Carbon_Fields\Datastore\Datastore_Interface

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

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

$type 공개적으로 프로퍼티

Stores the initial $type variable passed to the factory() method
또한 보기: factory
public string $type
리턴 string

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

Field value
protected mixed $value
리턴 mixed

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

The width of the field.
또한 보기: set_width()
protected int $width
리턴 integer