Form option for AnewtFormControlChoice.
Form option for AnewtFormControlChoice.
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.
__construct($value=null, $label=null) ¶Create a new AnewtFormOption.
$valueThe 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.
$labelThe human-visible label.
set_value($values) ¶Set the value for this group.
$valuesArray of values
This method is only intended to be called internally.
_ensure_selection($force_first=false) ¶Make sure a selection is set.
$force_firstWhether to forcibly enable the first option
This method is for internal use only.
all_disabled() ¶Returns whether this control is disabled.
_build_option() [private] ¶Build an option element to be included in a select element.
_build_checkbox() [private] ¶Build a checkbox to be included in multiple select controls.
_build_radiobutton() [private] ¶Build a radio button to be included in single select controls.
_build_label($input) [private] ¶Wrap an input element into a label element.
$_choice_control ¶Reference to the parent AnewtFormControlChoice.
$_option_group ¶Reference to the parent AnewtFormOptionGroup, if any.
$_selected ¶Whether this form option is selected.
$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.
AnewtContainer::_to_array()AnewtContainer::_add()AnewtContainer::delete()AnewtContainer::get()AnewtContainer::_isset()AnewtContainer::_seed()AnewtContainer::setdefault()AnewtContainer::getdefault()AnewtContainer::set()AnewtContainer::__isset()AnewtContainer::__set()AnewtContainer::__construct()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()