class SelectBox extends ChoiceControl

Select box control that allows single item selection.

Constants

Valid

validation rule

VALID

Methods

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

No description

setPrompt(string|Stringable|false $prompt)

Sets first prompt item in select box.

string|Stringable|false
getPrompt()

Returns first prompt item.

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

Sets options and option groups from which to choose.

Html
getControl()

No description

addOptionAttributes(array $attributes)

No description

setOptionAttribute(string $name, mixed $value = true)

Sets an attribute on all

bool
isOk()

Checks whether the current selection is valid (a non-prompt item is selected, or the control has a prompt/is disabled).

array
getOptionAttributes()

Returns all option attributes.

Details

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

No description

Parameters

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

at line 50
SelectBox setPrompt(string|Stringable|false $prompt)

Sets first prompt item in select box.

Parameters

string|Stringable|false $prompt

Return Value

SelectBox

at line 60
string|Stringable|false getPrompt()

Returns first prompt item.

Return Value

string|Stringable|false

at line 70
ChoiceControl setItems(array $items, bool $useKeys = true)

Sets options and option groups from which to choose.

Parameters

array $items
bool $useKeys

Return Value

ChoiceControl

at line 93
Html getControl()

No description

Return Value

Html

at line 125
SelectBox addOptionAttributes(array $attributes)

No description

Parameters

array $attributes

Return Value

SelectBox

at line 137
SelectBox setOptionAttribute(string $name, mixed $value = true)

Sets an attribute on all

Parameters

string $name
mixed $value

Return Value

SelectBox

at line 147
bool isOk()

Checks whether the current selection is valid (a non-prompt item is selected, or the control has a prompt/is disabled).

Return Value

bool

at line 161
array getOptionAttributes()

Returns all option attributes.

Return Value

array