\Fluent_Checkbox_Field

Fluent_Checkbox_Field simple checkbox field.

Summary

Methods
Properties
Constants
field_data()
schema()
render()
data_setup()
enqueue()
default_value()
$version
$domain
$url
$args
No constants found
parse_args()
provide()
random_string()
guid()
No protected properties found
N/A
default_args()
No private properties found
N/A

Properties

$version

$version : string

Type

string — Class version.

$domain

$domain : string

Type

string — Class text domain.

$url

$url : string

Type

string — fluent url.

$args

$args : array

Type

array — Class args to be run attached after <code>parse_args</code>.

Methods

field_data()

field_data() : array

Returns the default field data.

Returns

array —

default field data

schema()

schema(string $value, array $data) : mixed

Notify the Fluent_Options class of the schema needed for this field type within the values array.

Generally this will be an empty string just to register the key in the array, but custom fields and things like multi selects will need this to be an array. Groups use this to define the nested fields as well.

Parameters

string $value

the current value that will be used.

array $data

field data as supplied by the section or group.

Returns

mixed —

schema value type

render()

render(array $data, object $object)

Render the field HTML based on the data provided.

Parameters

array $data

field data.

object $object

Fluent_Options instance allowing you to alter anything if required.

data_setup()

data_setup(array $data) : array

Parse passed data with default data.

Parameters

array $data

supplied field data.

Returns

array —

parsed field data

enqueue()

enqueue(array $data, array $field_data)

Enqueue or register styles and scripts to be used when the field is rendered.

Parameters

array $data

field data.

array $field_data

locations and other data for the field type.

default_value()

default_value(string $default, array $data) : mixed

Allows the field class to reformat any supplied default value from the original supplied to the object instance.

Parameters

string $default

current default

array $data

field data

Returns

mixed —

default value

parse_args()

parse_args(array $a, array $b, string $filter) : array

Recursive array merging from a default and supplied array.

Very similar function to wp_parse_args except it filters through the whole array tree.

Parameters

array $a

supplied value array.

array $b

default value array.

string $filter

optionally run the array through apply_filters before returning.

Returns

array

provide()

provide(string $key) : array

The provide function is just a shorthand wrapper for suppling a class object and method as array in WordPress actions and filters.

Parameters

string $key

the method name to be added to the array: array( &$this, $key ).

Returns

array

random_string()

random_string(string $length) : string

Helper function used inside the <code>guid()</code> function to generate random strings.

Parameters

string $length

the number of characters to return.

Returns

string

guid()

guid() : string

Guid function used to reformat array index values before sedning them to the fields.

Simply replicates the behaviour found in framework javascript.

Returns

string

default_args()

default_args() : array

Function used across extended classes used in conjunction with <code>parse_args</code> to format supplied arrays and ensure all keys are supplied.

Returns

array