abstract class MultiChoiceControl extends BaseControl

Choice control that allows multiple items selection.

Properties

protected bool[] $disabledChoices
array $items

Methods

__construct(string|Stringable|null $label = null, array|null $items = null)

No description

void
loadHttpData()

No description

setValue($values)

No description

array
getValue()

Returns selected keys.

array
getRawValue()

Returns raw submitted keys without validation against the available items.

setItems(array $items, bool $useKeys = true)

Sets items from which to choose. When $useKeys is false, values are used as keys too.

array
getItems()

Returns items from which to choose.

array
getSelectedItems()

Returns key-value pairs for valid, non-disabled selected items.

setDisabled(bool|array $value = true)

Disables or enables control or items.

string
getHtmlName()

Returns HTML name of control.

checkDefaultValue(bool $value = true)

Enables or disables validation that set values exist in the items list.

mixed
getItem(string|int $key)

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

Parameters

string|Stringable|null $label
array|null $items

at line 39
void loadHttpData()

No description

Return Value

void

at line 48
MultiChoiceControl setValue($values)

internal  
 

No description

Parameters

$values

Return Value

MultiChoiceControl

at line 83
array getValue()

Returns selected keys.

Return Value

array

at line 93
array getRawValue()

Returns raw submitted keys without validation against the available items.

Return Value

array

at line 103
MultiChoiceControl setItems(array $items, bool $useKeys = true)

Sets items from which to choose. When $useKeys is false, values are used as keys too.

Parameters

array $items
bool $useKeys

Return Value

MultiChoiceControl

at line 114
array getItems()

Returns items from which to choose.

Return Value

array

at line 124
array getSelectedItems()

Returns key-value pairs for valid, non-disabled selected items.

Return Value

array

at line 140
MultiChoiceControl setDisabled(bool|array $value = true)

Disables or enables control or items.

Parameters

bool|array $value

Return Value

MultiChoiceControl

at line 154
string getHtmlName()

Returns HTML name of control.

Return Value

string

at line 163
MultiChoiceControl checkDefaultValue(bool $value = true)

Enables or disables validation that set values exist in the items list.

Parameters

bool $value

Return Value

MultiChoiceControl

at line 173
protected mixed getItem(string|int $key)

Returns the item label for the given key, or throws an exception if the key does not exist.

Parameters

string|int $key

Return Value

mixed