Selection
This field type represents a single selection or multiple choices from a list of options.
Name | Internal name | Expected input type |
---|---|---|
Selection | ezselection | mixed |
Description
The Selection
FieldType
stores single selections or multiple choices from a list of options, by populating a hash with the list of selected values.
Validation
This FieldType
validates the input, verifying if all selected options exist in the field definition, and, checks if multiple selections are allowed in the field definition.
If any of these validations fail a ValidationError
is thrown, specifying the error message, and for the case of the option validation a list with the invalid options is also presented.
Settings
Name | Type | Default value | Description |
---|---|---|---|
isMultiple | boolean | false | Used to allow or deny multiple selection from the option list. |
options | hash | array() | Stores the list of options defined in the field definition. |
Value object
Properties
The Value class of this field type contains the following properties:
Property | Type | Description |
---|---|---|
$selection | int[] | This property will be used for the list of selections, which will be a list of integer values, or one single integer value. |
Constructor
The Selection\Value
constructor accepts an array of selected elements identifiers.