Collection¶
The Collection
type generates a field for Inline-Relational-Record-Editing
(IRRE), which allows nesting of other field types as children.
This field type allows building structures like image sliders, accordion, tabs
and so on.
It corresponds with the TCA type => 'inline'
.
SQL overrides via alternativeSql
allowed: no.
First-level options¶
All options, which can be defined for Record Types can be used here as well.
-
fields
¶ Required: true Type: array Configures a set of fields as repeatable child objects. All fields defined in field types are possible as children. It is also possible to further nest Collection fields.
Example:
fields: - identifier: text type: Text - identifier: image type: File
Settings¶
-
maxitems
¶ Required: false Type: integer Default: 0 Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.
-
minitems
¶ Required: false Type: integer Default: 0 Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.
-
foreign_table
¶ Required: false Type: string (table) It is possible to reference another table instead of creating a new one. This table can be defined by another Content Block, but can also be an existing table defined by the Core or another extension. In case of another Content Block, the option
aggregateRoot
has to be set tofalse
, so that required fields are created. Existing tables need to manually define theforeign_table_parent_uid
,tablenames
andfieldname
fields.
For more advanced configuration refer to the TCA documentation
Custom icon¶
In order to define a custom icon for your Collection field, you may place an
image file inside Assets
called {identifier}.svg
. So for example if your
identifier for the Collection is my_collection
, then your image should be
named my_collection.svg
. Alternatively, you can also provide png or gif files.
These should be 64x64px.
Example¶
Minimal¶
name: example/collection
group: common
fields:
- identifier: collection
type: Collection
fields:
- identifier: text
type: Text
Advanced / use case¶
name: example/collection
group: common
fields:
- identifier: slides
type: Collection
labelField: title
maxitems: 5
minitems: 1
fields:
- identifier: image
type: File
minitems: 1
maxitems: 1
- identifier: title
type: Text
# This custom table needs to be defined in a separate Content Block
name: example/slide
table: my_slide
aggregateRoot: false
fields:
- identifier: image
type: File
name: example/collection
group: common
fields:
- identifier: slides
type: Collection
foreign_table: my_slide