Skip to the content
Documentation

RelationList Field Type (page id 31430535)

No ratings yet

This Field Type represents one or multiple relations to content.

Name Internal name Expected input
RelationList ezobjectrelationlist mixed

Description

This Field Type makes possible to store and retrieve values of relation to content.

PHP API Field Type 

Input expectations

Type Description Example
int|string Id of the related Content item 42
array An array of related Content IDs array( 24, 42 )
eZ\Publish\API\Repository\Values\Content\ContentInfo
ContentInfo instance of the related Content  
eZ\Publish\Core\FieldType\RelationList\Value RelationList Field Type Value Object See Value Object documentation section below.

Value Object

Properties

eZ\Publish\Core\FieldType\RelationList\Value contains following properties.

Property Type Description Example
destinationContentIds array An array of related Content ids array( 24, 42 )

Value object content example

Constructor

The RelationList\Value constructor will initialize a new Value object with the value provided. It expects a mixed array as value.

Constructor example

Validation

This Field Type validates if the selectionMethod specified is 0 (self::SELECTION_BROWSE) or 1 (self::SELECTION_DROPDOWN). A validation error is thrown if the value does not match.

Also validates if the selectionDefaultLocation specified is null, string or integer. If the type validation fails a validation error is thrown.

And validates if the value specified in selectionContentTypes is an array. If not, a validation error in given.

Settings

The field definition of this Field Type can be configured with following options:

Name Type Default value Description
selectionMethod mixed
SELECTION_BROWSE
Method of selection in the administration interface
selectionDefaultLocation string|integer null Id of the default Location for the selection when using administration interface
selectionContentTypes array array() An array of ContentType ids that are allowed for related Content

Following selection methods are available:

Name Description
SELECTION_BROWSE Selection will use browse mode
SELECTION_DROPDOWN Selection control will use dropdown control containing the Content list in the default Location for selection

NOTE: Dropdown not implemented in Platform UI yet, only browse is used currently.

Example of using settings in PHP

 

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.