class RadioInput extends ChoiceControl implements IValidationInput

Class RadioInput. Lets user choose one out of multiple options.

Traits

Trait ChoiceInputTrait.
Trait StandardValidationTrait.

Properties

protected array $rawItems from  ChoiceInputTrait

Methods

array
flatAssocArray(array $array)

Processes an associative array in a way that it has no nesting. Keys for nested arrays are lost, but nested arrays are merged.

array
makeOptionList(array $items, callable $optionArgs, array $valuesRendered = [])

Makes array of <option>. Can handle associative arrays just fine. Checks for duplicate values.

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

No description

bool
isControlDisabled()

Check if whole control is disabled.

bool
isValueDisabled($value)

Check if a specific value is disabled. If whole control is disabled, returns false.

bool
isValueSelected($value)

Self-explanatory

Html
showValidation( Html $control)

Modify control in such a way that it explicitly shows its validation state.

__construct(string|object $label = NULL, array $items = NULL)

No description

Html
getControl()

Generates control's HTML element.

Details

in ChoiceInputTrait at line 35
array flatAssocArray(array $array)

Processes an associative array in a way that it has no nesting. Keys for nested arrays are lost, but nested arrays are merged.

Parameters

array $array

Return Value

array

in ChoiceInputTrait at line 59
array makeOptionList(array $items, callable $optionArgs, array $valuesRendered = [])

Makes array of <option>. Can handle associative arrays just fine. Checks for duplicate values.

Parameters

array $items
callable $optionArgs takes ($value,$caption) and spits out an array of <option> attributes
array $valuesRendered for internal use. Do not change.

Return Value

array

Exceptions

InvalidArgumentException when $items have multiple of the same values

in ChoiceInputTrait at line 100
ChoiceInputTrait setItems(array $items, bool $useKeys = TRUE)

Parameters

array $items Items to set. Associative arrays are supported.
bool $useKeys

Return Value

ChoiceInputTrait

in ChoiceInputTrait at line 117
protected bool isControlDisabled()

Check if whole control is disabled.

This is false if only a set of values is disabled

Return Value

bool

in ChoiceInputTrait at line 131
protected bool isValueDisabled($value)

Check if a specific value is disabled. If whole control is disabled, returns false.

Parameters

$value mixed value to check for

Return Value

bool

in ChoiceInputTrait at line 149
protected bool isValueSelected($value)

Self-explanatory

Parameters

$value

Return Value

bool

at line 107
Html showValidation( Html $control)

Modify control in such a way that it explicitly shows its validation state.

Returns the modified element.

Parameters

Html $control

Return Value

Html

at line 41
__construct(string|object $label = NULL, array $items = NULL)

Parameters

string|object $label
array $items

at line 53
Html getControl()

Generates control's HTML element.

Return Value

Html