eZ Systems Website
  Editor documentation

  Developer documentation

  Back to the top

The documentation is moving!

We're moving our developer docs to Github and a new site.
The migration is still in progress, so please contact us in #documentation-contrib on eZ Community Slack if you have any questions or feedback.

This space will not be updated from now on except for critical fixes.

Skip to end of metadata
Go to start of metadata

This Field Type represents a single selection or multiple choices from a list of options.

NameInternal nameExpected input type


The Selection Field Type stores single selections or multiple choices from a list of options, by populating a hash with the list of selected values.

PHP API Field Type

Input expectations

arrayarray( 1, 2 )

Value object


The Value class of this Field Type contains the following properties:

$selectionint[]This property will be used for the list of selections, which will be a list of integer values, or one single integer value.
Value object content examples

The Selection\Value constructor accepts an array of selected element identifiers.

Constructor example
String representation

String representation of this Field Type is its list of selections as a string, concatenated with a comma.



Hash format

Hash format of this Field Type is the same as Value object's selection property.

Example of value in hash format


This Field Type 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.


NameTypeDefault valueDescription
isMultiplebooleanfalseUsed to allow or deny multiple selection from the option list.
optionshasharray()Stores the list of options defined in the field definition.
Selection Field Type example settings