Form option group for AnewtFormControlChoice.
Form option group for AnewtFormControlChoice.
This class represents a group of choices for an AnewtFormControlChoice instance. An option group has a label, which can be set specified using the label property. Option groups will be rendered in a visually distinct style. Note that options and option groups can be mixed in a single choice control.
Groups themselves cannot be selected, only the options it consists of (AnewtFormOption instance) can be selected. See the documentation for AnewtFormControlChoice and AnewtFormOption for details about selecting values in choice controls.
You can instantiate this class directly and add options to it using add_option() (with an AnewtFormOption instance) or using add_option_value_label(). Both methods work exactly like the methods of the same name (and signature) in the AnewtFormControlChoice class, but operate on the option group, instead of on the choice control as a whole.
After adding the options, add the the option group to a choice control using AnewtFormControlChoice::add_option_group().
__construct($label=null) ¶Create a new AnewtFormOptionGroup.
$labelThe human-visible label (optional). This can also be set later using the label property.
add_option($option) ¶Add an AnewtFormOption instance to this group.
For simple cases you may want to use add_option_value_label() instead.
$optionAn AnewtFormOption instance.
add_option_value_label($value, $label) ¶Add a new option to this group.
This is a convenience method to easily add an option to this group. Use add_option() if you want more control over the AnewtFormOption element added to this control.
$valueThe value of this option
$labelThe visible name for this option
get_values() ¶Get the values for this option group.
This method is for internal use only. Use the AnewtFormControlCheckbox instance to obtain the current selection.
Array of values (may be empty).
set_value($values) ¶Set the value for this group.
This method is only intended to be called internally.
$valuesArray of values
_ensure_selection($force_first=false) ¶Make sure a selection is set.
This method is for internal use only.
$force_firstWhether to force the first element to be selected.
all_disabled() ¶Checks if all options are disabled.
Returns true if there are no enabled controls. Returns false otherwise.
_build_option() ¶Build an option group element to be included in a select element.
_build_checkbox() ¶Build a checkbox (throws an error).
AnewtFormOptionGroup cannot be rendered as checkboxes.
_build_radiobutton() ¶Build a radio button (throws an error).
AnewtFormOptionGroup cannot be rendered as radio buttons.
$_choice_control ¶The choice control this group has been added to.
This value is only set after the group was added to a choice control, so it can only be used when processing or rendering the form.
$at_least_one_selected ¶Whether this group has at least one selected item.
This flag is for internal use only and is only valid when called directly after setting values on the parent choice control.
AnewtContainer::_to_array()AnewtContainer::_add()AnewtContainer::delete()AnewtContainer::get()AnewtContainer::_isset()AnewtContainer::_seed()AnewtContainer::setdefault()AnewtContainer::getdefault()AnewtContainer::set()AnewtContainer::__isset()AnewtContainer::__set()AnewtContainer::is_set()AnewtContainer::add()AnewtContainer::_getdefault()AnewtContainer::__unset()AnewtContainer::seed()AnewtContainer::to_array()AnewtContainer::_get()AnewtContainer::__get()AnewtContainer::keys()AnewtContainer::clear()AnewtContainer::_keys()AnewtContainer::_set()AnewtFormOption::$_option_groupAnewtFormOption::__construct()AnewtFormOption::$_selected