Public Member Functions | |
| __construct ($value=null, $label=null) | |
| Create a new AnewtFormOption. | |
| get_values () | |
| Get the value of this option. | |
| set_value ($values) | |
| Set the value for this group. | |
| _ensure_selection ($force_first=false) | |
| Make sure a selection is set. | |
| all_disabled () | |
| Returns whether this control is disabled. | |
Public Attributes | |
| $_choice_control | |
| Reference to the parent AnewtFormControlChoice. | |
| $_option_group | |
| Reference to the parent AnewtFormOptionGroup, if any. | |
| $_selected = false | |
| Whether this form option is selected. | |
| $at_least_one_selected | |
| Whether this option is selected. | |
Private Member Functions | |
| _build_option () | |
| Build an option element to be included in a select element. | |
| _build_checkbox () | |
| Build a checkbox to be included in multiple select controls. | |
| _build_radiobutton () | |
| Build a radio button to be included in single select controls. | |
| _build_label ($input) | |
| Wrap an input element into a label element. | |
This class represents a single choice for an AnewtFormControlChoice instance. You can instantiate this class directly and add it to a choice control using AnewtFormControlChoice::add_option(), however for most simple cases AnewtFormControlChoice::add_option_value_label() suffices.
In addition to the label and value, the disabled property can be set to disable specific option of an AnewtFormControlChoice. Note that if the containing AnewtFormControlChoice instance itself is disabled, all options will be automatically disabled as well.
Note that you cannot select form options directly. Use the value property of the containing AnewtFormControlChoice instead, e.g. use something like $choice_control->set('value', ...) to set the selection.
Definition at line 562 of file choice.lib.php.
| AnewtFormOption::__construct | ( | $ | value = null, |
|
| $ | label = null | |||
| ) |
Create a new AnewtFormOption.
| $value | The value that will be used as the AnewtFormControlChoice value if this option is selected. If the multiple property of the AnewtFormControlChoice instance is enabled, this is the value that will be included in the list of values of the control. | |
| $label | The human-visible label. |
Definition at line 607 of file choice.lib.php.
| AnewtFormOption::get_values | ( | ) |
Get the value of this option.
This method is only intended to be called internally.
Reimplemented in AnewtFormOptionGroup.
Definition at line 623 of file choice.lib.php.
| AnewtFormOption::set_value | ( | $ | values | ) |
Set the value for this group.
| $values | Array of values |
Reimplemented in AnewtFormOptionGroup.
Definition at line 640 of file choice.lib.php.
| AnewtFormOption::_ensure_selection | ( | $ | force_first = false |
) |
Make sure a selection is set.
| $force_first | Whether to forcibly enable the first option |
Reimplemented in AnewtFormOptionGroup.
Definition at line 658 of file choice.lib.php.
| AnewtFormOption::$at_least_one_selected |
Whether this option is selected.
This flag is for internal use only and is only valid when called directly after setting values on the parent choice control.
Reimplemented in AnewtFormOptionGroup.
Definition at line 592 of file choice.lib.php.
1.5.9