...
Name | Internal name | Expected input |
---|---|---|
RelationList | ezobjectrelationlist | mixed |
Table of contents:
Table of Contents | ||
---|---|---|
|
Description
This FieldType makes possible to store and retrieve values of relation to content.
Input expectations
Type | Description | Example |
---|---|---|
int|string | Id of the related Content | 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 FieldType Value Object | See Value Object documentation section below. |
...
Value Object API
Properties
eZ\Publish\Core\FieldType\RelationList\Value
offers contains following properties.
Property | Type | Description | Example |
---|---|---|---|
| array | An array of related Content ids | array( 24, 42 ) |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
$relationList->destinationContentId = array(
$contentInfo1->id,
$contentInfo2->id,
170
); |
Constructor
The RelationList
\Value
constructor will initialize a new Value object with the value provided. It expects a mixed array as value.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
// Instantiates a RelationList Value object
$relationListValue = new RelationList\Value(
array(
$contentInfo1->id,
$contentInfo2->id,
170
)
); |
Validation
This FieldType 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.
...
And validates if the value specified in selectionContentTypes
is an array. If not, a validation error in given.
Settings
The field definition of this FieldType can be configured with following options:
Name | Type | Default value | Description |
---|---|---|---|
| mixed | SELECTION_BROWSE | Method of selection in the administration interface |
| string|integer | null | Id of the default Location for the selection when using administration interface |
| array | array() | An array of ContentType ids that are allowed for related Content |
Following selection methods are available:
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
use eZ\Publish\Core\FieldType\RelationList\Type; $settings = array( "selectionMethod" => Type::SELECTION_BROWSE, "selectionRootselectionDefaultLocation" => null, "selectionContentTypes" => array() ); |
Value object
Properties
The Value class of this field type contains the following properties:
Property | Type | Description |
---|---|---|
| mixed[] | This property will be used to store the values provided, in the form of a mixed array, which will represent the related content list. |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
$relationList->destinationContentId = array(
$contentInfo1->id,
$contentInfo2->id,
170
); |
Constructor
The RelationList
\Value
constructor will initialize a new Value object with the value provided. It expects a mixed array as value.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
// Instantiates a RelationList Value object
$relationListValue = new RelationList\Value(
array(
$contentInfo1->id,
$contentInfo2->id,
170
)
); |