Class CMB2_Field
CMB2 field objects
- CMB2_Base
- CMB2_Field
Category: WordPress_Plugin
License: GPL-2.0+
Author: CMB2 team
Since: 1.1.0
Link: https://cmb2.io
Located at includes/CMB2_Field.php
Methods summary
public
|
|
public
mixed
|
|
public
string
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
array
|
|
public
mixed
|
|
public
array|integer|boolean
|
|
public
array|integer|boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
#
has_args_method( string $type )
Determine if current type has its own defaults field-arguments method. |
public
mixed
|
#
escaped_value( callable|string $func = 'esc_attr', mixed $meta_value = '' )
Escape the value before output. Defaults to 'esc_attr()' |
public
mixed
|
|
public
string
|
|
public
string
|
|
public
string
|
#
format_timestamp( integer $meta_value, string $format = 'date_format' )
Format the timestamp field value based on the field date/time format arg |
public
string
|
#
get_timestamp_format( string $format = 'date_format', string|integer $meta_value = 0 )
Return a formatted timestamp for a field |
public
mixed
|
|
public
|
|
public
|
|
public
string
|
|
public
string
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
string
|
|
public
string
|
#
get_string( string $text_key, string $fallback )
Retrieve text parameter from field's text array (if it has one), or use fallback text For back-compatibility, falls back to checking the options array. |
public
array|mixed
|
|
public
array
|
|
public
|
#
add_js_dependencies( array $dependencies = array() )
Store JS dependencies as part of the field args. |
public
|
|
public
array
|
|
public
string
|
|
public
string
|
|
public
mixed
|
|
public
array
|
|
protected
array
|
|
protected
array
|
|
protected
array
|
#
set_field_defaults_all_or_nothing_types( array $args )
Sets default arguments for the all-or-nothing field types. |
protected
array
|
|
protected
array
|
|
protected
array
|
#
get_default_args( array $field_args,
Get default field arguments specific to this CMB2 object. |
public
|
#
get_field_clone( array $field_args )
Returns a cloned version of this field object, but with modified/overridden field arguments. |
public
|
|
protected
array
|
#
convert_deprecated_params( array $args )
Converts deprecated field parameters to the current/proper parameter, and throws a deprecation notice. |
Methods inherited from CMB2_Base
__get()
,
current_object_type()
,
deprecated_param()
,
do_callback()
,
get_new_field()
,
get_param_callback_result()
,
maybe_callback()
,
maybe_hook()
,
maybe_hook_parameter()
,
object_id()
,
object_type()
,
peform_param_callback()
,
prop()
,
set_prop()
,
should_show()
,
unset_param_callback_cache()
Constants summary
Constants inherited from CMB2_Base
Properties summary
protected
string
|
$properties_name
The object properties name. |
#
'args'
|
public
mixed
|
$args
Field arguments |
#
array()
|
public
mixed
|
$group
Field group object or false (if no group) |
#
false
|
public
mixed
|
$value
Field meta value |
#
null
|
public
mixed
|
$escaped_value
Field meta value |
#
null
|
public
mixed
|
$index
Grouped Field's current numeric index during the save process |
#
0
|
protected
array
|
$field_options
Array of field options |
#
array()
|
protected
array
|
$strings
Array of provided field text strings |
|
public
string
|
$render_context
The field's render context. In most cases, 'edit', but can be 'display'. |
#
'edit'
|
public static
array
|
$callable_fields
All CMB2_Field callable field arguments. Can be used to determine if a field argument is callable. |
#
array(
'default_cb',
'classes_cb',
'options_cb',
'text_cb',
'label_cb',
'render_row_cb',
'display_cb',
'before_group',
'before_group_row',
'before_row',
'before',
'before_field',
'after_field',
'after',
'after_row',
'after_group_row',
'after_group',
)
|
protected
string
|
$hash_id
Represents a unique hash representing this field. |
#
''
|
Properties inherited from CMB2_Base
$callback_results
,
$cmb_id
,
$data_to_save
,
$object_id
,
$object_type
Magic properties inherited from CMB2_Base
$args
,
$cmb_id
,
$meta_box
,
$object_id
,
$object_type
,
$properties