This documentation is for a version that has reached its End Of Life. Such versions are no longer supported and don't receive security updates. Consider updating to a newer version.
RelationList field type¶
This field type makes it possible to store and retrieve values of a relation to other content items.
Name | Internal name | Expected input |
---|---|---|
RelationList |
ezobjectrelationlist |
mixed |
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 | [ 24, 42 ] |
Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo |
ContentInfo instance of the related Content | n/a |
Ibexa\Core\FieldType\RelationList\Value |
RelationList field type value object | See below. |
Value Object¶
Properties¶
Ibexa\Core\FieldType\RelationList\Value
contains the following properties:
Property | Type | Description | Example |
---|---|---|---|
destinationContentIds |
array |
An array of related Content IDs | [ 24, 42 ] |
1 2 3 4 5 6 |
|
Constructor¶
The RelationList\Value
constructor initializes a new value object with the value provided.
It expects a mixed array as value.
1 2 3 4 5 6 7 8 9 10 |
|
Validation¶
This field type validates if:
- the
selectionMethod
specified is\Ibexa\Core\FieldType\RelationList\Type::SELECTION_BROWSE
or\Ibexa\Core\FieldType\RelationList\Type::SELECTION_DROPDOWN
. A validation error is thrown if the value doesn't match. - the
selectionDefaultLocation
specified isnull
,string
orinteger
. If the type validation fails a validation error is thrown. - the value specified in
selectionContentTypes
is anarray
. If not, a validation error in given. - the number of content items selected in the field isn't greater than the
selectionLimit
.
Note
The dropdown selection method isn't implemented yet.
Settings¶
The field definition of this field type can be configured with the following options:
Name | Type | Default value | Description |
---|---|---|---|
selectionMethod |
mixed |
SELECTION_BROWSE |
Method of selection in the back-end interface. |
selectionDefaultLocation |
string|integer |
null |
ID of the default Location for the selection when using the back-end interface. |
selectionContentTypes |
array |
[] |
An array of content type IDs that are allowed for related Content. |
Following selection methods are available:
Name | Description |
---|---|
SELECTION_BROWSE |
Selection uses browse mode. |
SELECTION_DROPDOWN |
Not implemented yet |
Validators¶
Name | Type | Default value | Description |
---|---|---|---|
RelationListValueValidator[selectionLimit] |
integer |
0 |
The number of content items that can be selected in the field. When set to 0, any number can be selected. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|