Fieldmanager
  • Package
  • Class
  • Tree
  • Todo

Packages

  • Fieldmanager
    • Context
    • Datasource
    • Field
    • Util
  • None

Classes

  • Fieldmanager_Autocomplete
  • Fieldmanager_Checkbox
  • Fieldmanager_Checkboxes
  • Fieldmanager_Colorpicker
  • Fieldmanager_Datepicker
  • Fieldmanager_DraggablePost
  • Fieldmanager_Field
  • Fieldmanager_Grid
  • Fieldmanager_Group
  • Fieldmanager_Hidden
  • Fieldmanager_Link
  • Fieldmanager_Media
  • Fieldmanager_Options
  • Fieldmanager_Password
  • Fieldmanager_Radios
  • Fieldmanager_RichTextArea
  • Fieldmanager_Select
  • Fieldmanager_TextArea
  • Fieldmanager_TextField

Class Fieldmanager_Group

Define a groups of fields.

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.

Fieldmanager_Field
Extended by Fieldmanager_Group
Package: Fieldmanager\Field
Located at class-fieldmanager-group.php

Methods summary

public
# __construct( string $label = '', array $options = array() )

Constructor; add CSS if we're looking at a tabbed view

Constructor; add CSS if we're looking at a tabbed view

Parameters

$label
string
$label title of form field
$options
array
$options with keys matching vars of the field in use.

Overrides

Fieldmanager_Field::__construct
public string
# form_element( mixed $value = NULL )

Render the element, iterating over children and calling their form_element() functions.

Render the element, iterating over children and calling their form_element() functions.

Parameters

$value
mixed
$value

Returns

string
HTML for the element. Generate HTML for the form element itself. Generally should be just one tag, no wrappers.

Overrides

Fieldmanager_Field::form_element
public
# add_child( Fieldmanager_Field $child )

Add a child element to this group.

Add a child element to this group.

Parameters

$child
Fieldmanager_Field
$child
public mixed[]
# presave( mixed $values, mixed $current_values = array() )

Presave override for groups which dispatches to child presave_all methods.

Presave override for groups which dispatches to child presave_all methods.

Parameters

$values
mixed
$value If a single field expects to manage an array, it must override presave()
$current_values

Returns

mixed[]
values

Input

mixed[] values

Overrides

Fieldmanager_Field::presave
public string
# get_element_label( array $classes = array() )

Get an HTML label for this element.

Get an HTML label for this element.

Parameters

$classes
array
$classes extra CSS classes.

Returns

string
HTML label.

Overrides

Fieldmanager_Field::get_element_label
public string
# wrap_with_multi_tools( string $html, mixed $classes = array() )

Groups have their own drag and remove tools in the label.

Groups have their own drag and remove tools in the label.

Parameters

$html
string
$html
$classes

Returns

string

Overrides

Fieldmanager_Field::wrap_with_multi_tools
public array
# get_extra_element_classes( )

Maybe add the collapsible class for groups

Maybe add the collapsible class for groups

Returns

array

Overrides

Fieldmanager_Field::get_extra_element_classes

Methods inherited from Fieldmanager_Field

_invalid_definition(), _unauthorized_access(), activate_submenu_page(), add_another(), add_meta_box(), add_page_form(), add_quickedit_box(), add_submenu_page(), add_term_meta_box(), add_user_form(), element_markup(), escape(), get_collapse_handle(), get_element_attributes(), get_element_id(), get_element_key(), get_form_name(), get_form_tree(), get_remove_handle(), get_sort_handle(), is_group(), is_repeatable(), preload_alter_values(), presave_all(), set_options(), single_element_markup()

Magic methods summary

Properties summary

public Fieldmanager_Field[] $children
#

Children elements of this group. Not much point in creating an empty group.

Children elements of this group. Not much point in creating an empty group.

public string $field_class
#

Override field class

Override field class

public string $label_element
#

Override label element

Override label element

public boolean $collapsible
#

If true, this group can be collapsed by clicking its header.

If true, this group can be collapsed by clicking its header.

public boolean $collapsed
#

If true, this group is collapsed by default.

If true, this group is collapsed by default.

public boolean|string $tabbed
#

Use tabbed groups. Currently supports "horizontal" or "vertical". Default is false, which means that the group will not be tabbed.

Use tabbed groups. Currently supports "horizontal" or "vertical". Default is false, which means that the group will not be tabbed.

public integer $tab_limit
#

How many tabs, maximum?

How many tabs, maximum?

public boolean $persist_active_tab
#

Persist the active tab on the group between sessions

Persist the active tab on the group between sessions

public array $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' )

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 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.

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_token
#

CSS selector to an element to get the token for the label format

CSS selector to an element to get the token for the label format

public callable|null $group_is_empty
#

Function that tells whether the group is empty or not. Gets an array of form values.

Function that tells whether the group is empty or not. Gets an array of form values.

public boolean $add_to_prefix
#

Should the group name be included in the meta key prefix for separate fields? Default is true.

Should the group name be included in the meta key prefix for separate fields? Default is true.

If false, Fieldmanager will not check for collisions among the meta keys created for this group's fields and other registered fields.

public boolean $has_unserialized_descendants
#

Flag that this field has some descendant with $serialize_data => false.

Flag that this field has some descendant with $serialize_data => false.

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).

Properties inherited from Fieldmanager_Field

$add_more_label, $add_more_position, $attributes, $data_id, $data_type, $datasource, $debug, $default_value, $description, $description_after_element, $display_if, $escape, $extra_elements, $index, $index_filter, $inline_label, $input_type, $is_attachment, $label, $label_after_element, $limit, $meta_boxes_to_remove, $minimum_count, $name, $one_label_per_item, $remove_default_meta_boxes, $required, $sanitize, $save_empty, $serialize_data, $skip_save, $sortable, $template, $validate, $validation_messages, $validation_rules

Fieldmanager API documentation generated by ApiGen 2.8.0