ChoiceControl
abstract class ChoiceControl extends BaseControl
Choice control that allows single item selection.
Properties
| protected bool[] | $disabledChoices | ||
| array | $items |
Methods
No description
No description
Sets selected item (by key).
Returns the selected key, or null if no valid item is selected or the selection is disabled.
Returns the raw submitted key without validation against the available items.
Is any item selected?
Sets items from which to choose. When $useKeys is false, values are used as keys too.
Returns items from which to choose.
Returns selected value.
Disables or enables control or items.
Enables or disables validation that the set value exists in the items list.
Returns the item label for the given key, or throws an exception if the key does not exist.
Details
at line 30
__construct(string|Stringable|null $label = null, array|null $items = null)
No description
at line 39
void
loadHttpData()
No description
at line 51
ChoiceControl
setValue(string|int|BackedEnum|null $value)
| internal |
Sets selected item (by key).
at line 71
mixed
getValue()
Returns the selected key, or null if no valid item is selected or the selection is disabled.
at line 84
string|int|null
getRawValue()
Returns the raw submitted key without validation against the available items.
at line 93
bool
isFilled()
Is any item selected?
at line 103
ChoiceControl
setItems(array $items, bool $useKeys = true)
Sets items from which to choose. When $useKeys is false, values are used as keys too.
at line 114
array
getItems()
Returns items from which to choose.
at line 123
mixed
getSelectedItem()
Returns selected value.
at line 134
ChoiceControl
setDisabled(bool|array $value = true)
Disables or enables control or items.
at line 148
ChoiceControl
checkDefaultValue(bool $value = true)
Enables or disables validation that the set value exists in the items list.
at line 158
protected mixed
getItem(string|int $key)
Returns the item label for the given key, or throws an exception if the key does not exist.