PHP Класс Fieldmanager_Options, vip-mu-plugins-public

Наследование: extends Fieldmanager_Field
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$data array Full option data, allows grouping
$first_element array Always prepend this element to the $data
$grouped boolean Is the data grouped? E.g. should we use
$multiple boolean Allow multiple selections?
$options array Shortcut to data which allows a simple associative array
$options_template string Path to an options template to load.

Открытые методы

Метод Описание
__construct ( string $label = '', mixed $options = [] ) Add CSS, construct parent
add_options ( array $options ) : void Add options
form_data_element ( $data_row, mixed $value ) A single element for a single bit of data, e.g. '
form_data_elements ( mixed $value ) : string Generate form elements.
option_selected ( string $current_option, array $options, string $attribute ) : string Helper for output functions to toggle a selected options
preload_alter_values ( array $values ) Alter values before rendering
presave ( mixed $value, $current_value = [] ) : sanitized Presave function, which handles sanitization and validation
presave_all ( $values, $current_values ) : mixed[] Override presave_all to handle special cases associated with multiple options fields.
presave_alter_values ( int[] $values, int[] $current_values = [] ) : int[] Presave hook to set taxonomy data, maybe
sanitize ( array | string $value ) : array | string Sanitize function that can handle arrays as well as string values.

Защищенные методы

Метод Описание
add_meta_boxes_to_remove ( &$meta_boxes_to_remove ) : array Helper function to get the list of default meta boxes to remove.
add_option_data ( string $name, mixed $value, string $group = null, string | integer $group_id = null ) : void Add option data to the data attribute of this object

Описание методов

__construct() публичный Метод

Add CSS, construct parent
public __construct ( string $label = '', mixed $options = [] )
$label string
$options mixed

add_meta_boxes_to_remove() защищенный Метод

If $remove_default_meta_boxes is true and the datasource is Fieldmanager_Datasource_Term, this will return a list of all default meta boxes for the specified taxonomies. We only need to return id and context since the page will be handled by the list of post types provided to add_meta_box. Otherwise, this will just return an empty array.
protected add_meta_boxes_to_remove ( &$meta_boxes_to_remove ) : array
Результат array list of meta boxes to remove

add_option_data() защищенный Метод

Add option data to the data attribute of this object
protected add_option_data ( string $name, mixed $value, string $group = null, string | integer $group_id = null ) : void
$name string
$value mixed
$group string
$group_id string | integer
Результат void

add_options() публичный Метод

Add options
public add_options ( array $options ) : void
$options array
Результат void

form_data_element() публичный Метод

A single element for a single bit of data, e.g. '
public form_data_element ( $data_row, mixed $value )
$value mixed

form_data_elements() публичный Метод

Generate form elements.
public form_data_elements ( mixed $value ) : string
$value mixed
Результат string HTML

option_selected() публичный Метод

Helper for output functions to toggle a selected options
public option_selected ( string $current_option, array $options, string $attribute ) : string
$current_option string this option
$options array all valid options
$attribute string
Результат string $attribute on match, empty on failure.

preload_alter_values() публичный Метод

Alter values before rendering
public preload_alter_values ( array $values )
$values array

presave() публичный Метод

Presave function, which handles sanitization and validation
public presave ( mixed $value, $current_value = [] ) : sanitized
$value mixed If a single field expects to manage an array, it must override presave()
Результат sanitized values.

presave_all() публичный Метод

Override presave_all to handle special cases associated with multiple options fields.
public presave_all ( $values, $current_values ) : mixed[]
Результат mixed[] sanitized values

presave_alter_values() публичный Метод

Presave hook to set taxonomy data, maybe
public presave_alter_values ( int[] $values, int[] $current_values = [] ) : int[]
$values int[]
$current_values int[]
Результат int[] $values

sanitize() публичный Метод

Sanitize function that can handle arrays as well as string values.
public sanitize ( array | string $value ) : array | string
$value array | string
Результат array | string Sanitized $value

Описание свойств

$data публичное свойство

Full option data, allows grouping
public array $data
Результат array

$first_element публичное свойство

Always prepend this element to the $data
public array $first_element
Результат array

$grouped публичное свойство

Is the data grouped? E.g. should we use
public bool $grouped
Результат boolean

$multiple публичное свойство

Allow multiple selections?
public bool $multiple
Результат boolean

$options публичное свойство

Shortcut to data which allows a simple associative array
public array $options
Результат array

$options_template публичное свойство

Path to an options template to load.
public string $options_template
Результат string