eZ Documentation Center

This is outdated documentation made for eZ Publish Platform 5.2. It is being moved into the eZ Publish 5.x documentation, so please go there for most up-to-date documentation.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3


This field type represents a single selection or multiple choices from a list of options.

NameInternal nameExpected input type


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


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.


NameTypeDefault valueDescription
isMultiplebooleanfalseUsed to allow or deny multiple selection from the option list.
optionshasharray()Stores the list of options defined in the field definition.
Code Block
titleSelection FieldType example settings
use eZ\Publish\Core\FieldType\Selection\Type;
$settings = array(
    "isMultiple" => true,
    "options" => array(1 => 'One', 2 => 'Two', 3 => 'Three')


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.
Code Block
titleValue object content examples
// Single selection
$value->selection = 1; 
// Multiple selection
$value->selection = array( 1, 4, 5 ); 



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

Code Block
titleConstructor example
// Instanciates a selection value with items #1 and #2 selected
$selectionValue = new Selection\Value( array( 1, 2 ) );