Public Member Functions | |
| __construct ($label=null) | |
| Create a new AnewtFormOptionGroup. | |
| add_option ($option) | |
| Add an AnewtFormOption instance to this group. | |
| add_option_value_label ($value, $label) | |
| Add a new option to this group. | |
| get_values () | |
| Get the values for this option group. | |
| set_value ($values) | |
| Set the value for this group. | |
| _ensure_selection ($force_first=false) | |
| Make sure a selection is set. | |
| all_disabled () | |
| Checks if all options are disabled. | |
| _build_option () | |
| Build an option group element to be included in a select element. | |
| _build_checkbox () | |
| Build a checkbox (throws an error). | |
| _build_radiobutton () | |
| Build a radio button (throws an error). | |
Public Attributes | |
| $_options = array() | |
| List of options in this group. | |
| $_choice_control = null | |
| The choice control this group has been added to. | |
| $at_least_one_selected | |
| Whether this group has at least one selected item. | |
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().
Definition at line 799 of file choice.lib.php.
| AnewtFormOptionGroup::__construct | ( | $ | label = null |
) |
Create a new AnewtFormOptionGroup.
| $label | The human-visible label (optional). This can also be set later using the label property. |
Reimplemented from AnewtContainer.
Definition at line 835 of file choice.lib.php.
| AnewtFormOptionGroup::add_option | ( | $ | option | ) |
Add an AnewtFormOption instance to this group.
For simple cases you may want to use add_option_value_label() instead.
| $option | An AnewtFormOption instance. |
Definition at line 857 of file choice.lib.php.
| AnewtFormOptionGroup::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.
| $value | The value of this option | |
| $label | The visible name for this option |
Definition at line 881 of file choice.lib.php.
| AnewtFormOptionGroup::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.
Reimplemented from AnewtFormOption.
Definition at line 898 of file choice.lib.php.
| AnewtFormOptionGroup::set_value | ( | $ | values | ) |
Set the value for this group.
This method is only intended to be called internally.
| $values | Array of values |
Reimplemented from AnewtFormOption.
Definition at line 919 of file choice.lib.php.
| AnewtFormOptionGroup::_ensure_selection | ( | $ | force_first = false |
) |
Make sure a selection is set.
This method is for internal use only.
| $force_first | Whether to force the first element to be selected. |
Reimplemented from AnewtFormOption.
Definition at line 955 of file choice.lib.php.
| AnewtFormOptionGroup::all_disabled | ( | ) |
Checks if all options are disabled.
true if there are no enabled controls. Returns false otherwise. Reimplemented from AnewtFormOption.
Definition at line 986 of file choice.lib.php.
| AnewtFormOptionGroup::_build_checkbox | ( | ) |
Build a checkbox (throws an error).
AnewtFormOptionGroup cannot be rendered as checkboxes.
Reimplemented from AnewtFormOption.
Definition at line 1032 of file choice.lib.php.
| AnewtFormOptionGroup::_build_radiobutton | ( | ) |
Build a radio button (throws an error).
AnewtFormOptionGroup cannot be rendered as radio buttons.
Reimplemented from AnewtFormOption.
Definition at line 1042 of file choice.lib.php.
| AnewtFormOptionGroup::$_options = array() |
List of options in this group.
This is an array of AnewtFormOption instances.
Definition at line 808 of file choice.lib.php.
| AnewtFormOptionGroup::$_choice_control = null |
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.
Reimplemented from AnewtFormOption.
Definition at line 817 of file choice.lib.php.
| AnewtFormOptionGroup::$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.
Reimplemented from AnewtFormOption.
Definition at line 826 of file choice.lib.php.
1.5.9