Message-ID: <1970088454.4134.1485857835228.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_4133_371559482.1485857835228" ------=_Part_4133_371559482.1485857835228 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html RelationList Field Type

RelationList Field Type

=20
=20
=20
=20

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\Val=
ues\Content\ContentInfo

ContentInfo instance of the rel= ated Content

 
eZ\Publish\Core\FieldType\Re= lationList\Value RelationList Field Type Value Obje= ct See Value Object documentation sec= tion 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
=20
$relationList->destinationContentId =3D array(=20
=09$contentInfo1->id,
=09$contentInfo2->id,
=09170
);
=20
Constructor

The RelationList\Value constructor w= ill initialize a new Value object with the value provided. It exp= ects a mixed array as value.

Constructor example
=20
// Instantiates a RelationList Value object
$relationListValue =3D new RelationList\Value(
=09array(
=09=09$contentInfo1->id,
=09=09$contentInfo2->id,
=09=09170=09=09
=09)
);
=20

Validation

This Field Type validates if the selectionMetho= d 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 select= ionDefaultLocation specified is null, string or integer. If the = type validation fails a validation error is thrown.

And validates if the value specified in selecti= onContentTypes is an array. If not, a validation error in giv= en.

Settings

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

Name Type Default value Description

s= electionMethod

mixed
SELECTION_BROWSE
Method of selection in the administration interf= ace

s= electionDefaultLocation

string|integer null Id of the default Location for the selection whe= n using administration interface

s= electionContentTypes

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 cont= aining the Content list in the default Location for selection

NOTE: Dropdown not implemented in Platform UI yet, only browse is used c= urrently.

Example of using settings in PHP
=20
use eZ\Publish\Core\FieldType\RelationList\Type;

$settings =3D array(
=09"selectionMethod" =3D> Type::SELECTION_BROWSE,
=09"selectionDefaultLocation" =3D> null,
    "selectionContentTypes" =3D> array()
 );
=20
=20
=20
=20
=20

 

=20
=20
=20
------=_Part_4133_371559482.1485857835228--