This field type represents a relation to a content item.
|Name||Internal name||Expected input|
Table of contents:
This FieldType makes possible to store and retrieve the value of relation to a content item.
The Value class of this field type contains the following properties:
|This property will be used to store the value provided, which will represent the related content.|
$relation->destinationContentId = $contentInfo->id;
\Value constructor will initialize a new Value object with the value provided. It expects a mixed value
// Instantiates a Relation Value object $relationValue = new Relation\Value( $contentInfo->id );
This FieldType validates the provided relation exists, but before it does that it will check that the value is either string or int.
The field definition of this FieldType can be configured with two or three options:
|This setting defines the selection method. It expects an integer (0/1). 0 stands for |
|This setting defines the selection root.|
|An array of ContentType ids that are allowed for related Content|
use eZ\Publish\Core\FieldType\Relation\Type; $settings = array( "selectionMethod" => 1, "selectionRoot" => null );
Note: These settings are meant for future use in user interface when allowing users to select relations.