Message-ID: <38441900.4444.1485866496163.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_4443_296414789.1485866496163" ------=_Part_4443_296414789.1485866496163 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This field type represents a single selection or multiple choices from a= list of options.
Name | Internal name | Expected input type |
---|---|---|
Selection |
ezselection |
mixed |
The Selection
FieldType
stores single selectio=
ns or multiple choices from a list of options, by populating a hash with th=
e list of selected values.
This FieldType
validates the input, verifying if all select=
ed options exist in the field definition, and, checks if multiple selection=
s are allowed in the field definition.
If any of these validations fail =
a ValidationError
&=
nbsp; is thrown, specifying the error message, and for the case of t=
he option validation a list with the invalid options is also presented.
Name | Type | Default value | Description |
---|---|---|---|
isMultiple |
boolean |
false |
Used to allow or deny multiple selection from th= e option list. |
options |
hash |
array() |
Stores the list of options defined in the field = definition. |
use eZ\Publish\Core\FieldType\Selection\Type; =20 $settings =3D array( "isMultiple" =3D> true, "options" =3D> array(1 =3D> 'One', 2 =3D> 'Two', 3 =3D> 'Th= ree') );=20
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 selec= tions, which will be a list of integer values, or one single integer value.= |
// Single selection $value->selection =3D 1;=20 =20 // Multiple selection $value->selection =3D array( 1, 4, 5 );=20
The Selection\Value
constructo=
r accepts an array of selected elements identifiers.
// Instanciates a selection value with items #1 and #2 selected $selectionValue =3D new Selection\Value( array( 1, 2 ) );=20