Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

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
Selectionezselectionmixed

Table of contents:

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.

Input expectations


TypeExample
arrayarray( 1, 2 )

Value object


Properties

The Value class of this field type contains the following properties:

PropertyTypeDescription
$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

Constructor

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

Constructor example

String representation

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

Example:

"1,2,24,42"

Hash format


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

Example of value in hash format

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


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 FieldType example settings