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

The Relation Field Type

This Field Type represents a relation to a Content item.

Name Internal name Expected input
Relation ezobjectrelation mixed

Table of contents:

=20 =20

Description

This Field Type makes it possible to store and retrieve the value of rel= ation to a Content item.

Input expectations

Type Example
string
"150"
integer  150

Value object

Properties

The Value class of this Field Type contains the following properties:

Property Type Description
$destinationContentId string|int|null This property will be used to stor= e the value provided, which will represent the related content.
Value object content example
=20
$relation->destinationContentId =3D $contentInfo->id;
= =20

Constructor

The Relation\Value constructor will&= nbsp;initialize a new Value object with the value provided. It expects a mi= xed value.

Constructor example
=20
// Instantiates a Relation Value object
$relationValue =3D new Relation\Value( $contentInfo->id );
=20

Validation

This Field Type validates whether the provided relation exists, but befo= re it does that it will check that the value is either string or int.

Settings

The field definition of this Field Type can be configured with two optio= ns:

Name Type Default value Description
selectionMethod<= /code> int self::SELECTION_BROWSE This setting defines the selection method. It ex= pects an integer (0/1). 0 stands for self::SELECTION_BROWSE, 1= stands for self::SELECTION_DROPDOWN.
selection= Root string null This setting defines the selection= root.
Relation FieldType example settings
=20
use eZ\Publish\Core\FieldType\Relation\Type;

$settings =3D array(
=09"selectionMethod" =3D> 1,
=09"selectionRoot" =3D> null
);
=20

Note: These settings are meant for future use in user interface when all= owing users to select relations.

 

------=_Part_3391_1752492987.1485852917717--