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

Groups shouldn't just be thought of as a top-level collection of fields (like a meta box). Groups can be infinitely nested, they can be used to create tabbed interfaces, and so on. Groups submit data as nested arrays.
Наследование: extends Fieldmanager_Field
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$add_to_prefix boolean If false, Fieldmanager will not check for collisions among the meta keys created for this group's fields and other registered fields.
$children Fieldmanager_Field[] Children elements of this group. Not much point in creating an empty group.
$collapsed boolean If true, this group is collapsed by default.
$collapsible boolean If true, this group can be collapsed by clicking its header.
$field_class string Override field class
$group_is_empty callable | null Function that tells whether the group is empty or not. Gets an array of form values.
$has_unserialized_descendants boolean This field is set based on its descendants, but you can deliberately set it yourself if your situation is one where this cannot be determined automatically (for instance, where descendants are added after the group has been constructed).
$label_element string Override label element
$label_format string If specified, $label_format combined with $label_token will override $label, but only if $(label).find(label_token).val() is not null.
$label_macro array Label macro is a more convenient shortcut to label_format and label_token. The first element of the two-element array is the title with a placeholder (%s), and the second element is simply the name of the child element to pull from, e.g.: array( 'Section: %s', 'section_title' )
$label_token string CSS selector to an element to get the token for the label format
$persist_active_tab boolean Persist the active tab on the group between sessions
$tab_limit integer How many tabs, maximum?
$tabbed boolean | string Use tabbed groups. Currently supports "horizontal" or "vertical". Default is false, which means that the group will not be tabbed.

Защищенные свойства (Protected)

Свойство Тип Описание
$child_count boolean Iterator value for how many children we have rendered.

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

Метод Описание
__construct ( $label = '', $options = [] ) Constructor; add CSS if we're looking at a tabbed view
add_child ( Fieldmanager_Field $child ) : void Add a child element to this group.
form_element ( mixed $value = NULL ) Render the element, iterating over children and calling their form_element() functions.
get_element_label ( array $classes = [] ) : string Get an HTML label for this element.
get_extra_element_classes ( ) : array Maybe add the collapsible class for groups
presave ( $values, $current_values = [] ) : mixed[] Presave override for groups which dispatches to child presave_all methods.
wrap_with_multi_tools ( string $html, $classes = [] ) : string Groups have their own drag and remove tools in the label.

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

Метод Описание
add_meta_boxes_to_remove ( &$meta_boxes_to_remove ) : array Helper function to get the list of default meta boxes to remove.

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

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

Constructor; add CSS if we're looking at a tabbed view
public __construct ( $label = '', $options = [] )

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

Add a child element to this group.
public add_child ( Fieldmanager_Field $child ) : void
$child Fieldmanager_Field
Результат void

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

For Fieldmanager_Group, iterate over all children to see if they have meta boxes to remove. If $remove_default_meta_boxes is true for this group, set all children to also remove any default meta boxes if applicable.
protected add_meta_boxes_to_remove ( &$meta_boxes_to_remove ) : array
$meta_boxes_to_remove the array of meta boxes to remove
Результат array list of meta boxes to remove

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

Render the element, iterating over children and calling their form_element() functions.
public form_element ( mixed $value = NULL )
$value mixed

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

Get an HTML label for this element.
public get_element_label ( array $classes = [] ) : string
$classes array extra CSS classes.
Результат string HTML label.

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

Maybe add the collapsible class for groups
public get_extra_element_classes ( ) : array
Результат array

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

Presave override for groups which dispatches to child presave_all methods.
public presave ( $values, $current_values = [] ) : mixed[]
Результат mixed[] values

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

Groups have their own drag and remove tools in the label.
public wrap_with_multi_tools ( string $html, $classes = [] ) : string
$html string
Результат string

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

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

If false, Fieldmanager will not check for collisions among the meta keys created for this group's fields and other registered fields.
public bool $add_to_prefix
Результат boolean

$child_count защищенное свойство

Iterator value for how many children we have rendered.
protected bool $child_count
Результат boolean

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

Children elements of this group. Not much point in creating an empty group.
public Fieldmanager_Field[] $children
Результат Fieldmanager_Field[]

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

If true, this group is collapsed by default.
public bool $collapsed
Результат boolean

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

If true, this group can be collapsed by clicking its header.
public bool $collapsible
Результат boolean

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

Override field class
public string $field_class
Результат string

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

Function that tells whether the group is empty or not. Gets an array of form values.
public callable|null $group_is_empty
Результат callable | null

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

This field is set based on its descendants, but you can deliberately set it yourself if your situation is one where this cannot be determined automatically (for instance, where descendants are added after the group has been constructed).
public bool $has_unserialized_descendants
Результат boolean

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

Override label element
public string $label_element
Результат string

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

If specified, $label_format combined with $label_token will override $label, but only if $(label).find(label_token).val() is not null.
public string $label_format
Результат string

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

Label macro is a more convenient shortcut to label_format and label_token. The first element of the two-element array is the title with a placeholder (%s), and the second element is simply the name of the child element to pull from, e.g.: array( 'Section: %s', 'section_title' )
public array $label_macro
Результат array

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

CSS selector to an element to get the token for the label format
public string $label_token
Результат string

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

Persist the active tab on the group between sessions
public bool $persist_active_tab
Результат boolean

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

How many tabs, maximum?
public int $tab_limit
Результат integer

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

Use tabbed groups. Currently supports "horizontal" or "vertical". Default is false, which means that the group will not be tabbed.
public bool|string $tabbed
Результат boolean | string