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
파일 보기 프로젝트 열기: Automattic/vip-mu-plugins-public 1 사용 예제들

공개 프로퍼티들

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

보호된 프로퍼티들

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