Collection 

The Collection type generates a field for Inline-Relational-Record-Editing (IRRE), which allows nesting of other field types. This field type allows building structures like image sliders, accordions, tabs and so on.

Collections will automatically create custom tables and use the identifier as table name. It is possible to override this with the setting table. Collections are always hidden in the List module. Usually Collections only have one type. To realise multiple types it is recommended to extract the definition to a separate Record Type and use foreign_table instead.

Custom icon 

In order to define a custom icon for your Collection field, you may place an image file inside assets folder 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.

Settings 

Name Type Default Required
string|array true
array
string
array true
integer "0"
integer "0"
string oneToMany
bool|null null
string top
boolean
boolean true
boolean
string
string
boolean false
boolean false
boolean true
boolean
boolean
boolean
object
boolean
boolean
string (table)
string (field)
boolean false
boolean false
array []
integer
boolean false
boolean false
boolean true
array
object
object
object
array
string
string
object
string
string
string
string
string
string
object
boolean false
integer 1
string
string
string
array []

labelField

labelField
Type
string|array
Required

true

Defines which field should be used as the title of the record. If not defined, the first valid child field will be used as the label. It is possible to define an array of fields, which will be displayed comma-separated in the backend.

# a single field for the label
labelField: title

# multiple fields will be displayed comma-separated
labelField:
    - title
    - text
Copied!

fallbackLabelFields

fallbackLabelFields
Type
array

Defines which fields should be used as fallback, if labelField is not filled. The first filled field which is found will be used. Can only be used if there is only one labelField field defined.

# fallback fields will be used, if title from labelField is empty
labelField: title
fallbackLabelFields:
    - text1
    - text2
Copied!

table

table
Type
string

Alternative table name for the Collection. Default is identifier with prefix if enabled.

table: tx_vendor_my_custom_table_name
Copied!

fields

fields
Type
array
Required

true

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
Copied!

minitems

minitems
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.

maxitems

maxitems
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.

relationship

relationship
Type
string
Default
oneToMany

The relationship defines the cardinality between the relations. Possible values are oneToMany (default), manyToOne and oneToOne. In case of a [x]toOne relation, the processed field will be filled directly with the record instead of a collection of records. In addition, maxitems will be automatically set to 1.

appearance.collapseAll

appearance.collapseAll
Type
bool|null
Default
null
  • Default (null): Last collapsed/expanded state is remembered
  • true: Show all child records collapsed
  • false: Show all child records expanded

appearance.levelLinksPosition

appearance.levelLinksPosition
Type
string
Default
top

Defines where to show the "New record" link in relation to the child records. Valid keywords are top, bottom and both.

appearance.expandSingle

appearance.expandSingle
Type
boolean

When enabled, only one child record is expanded at a time. Clicking a collapsed record collapses the currently open one.

appearance.newRecordLinkAddTitle

appearance.newRecordLinkAddTitle
Type
boolean

Adds the title of the foreign table to the "New record" link label.

appearance.newRecordLinkTitle

appearance.newRecordLinkTitle
Type
string

Overrides the "New record" link label with a localized string. Only takes effect if appearance.newRecordLinkAddTitle is not set to true.

appearance.createNewRelationLinkTitle

appearance.createNewRelationLinkTitle
Type
string

Overrides the "Create new relation" button label with a localized string. Only useful when the element browser is enabled.

appearance.useCombination

appearance.useCombination
Type
boolean
Default
false

Enables editing of intermediate table attributes alongside the related child record in bidirectional relations. Requires foreign_selector and foreign_unique to be set to the same field.

appearance.suppressCombinationWarning

appearance.suppressCombinationWarning
Type
boolean
Default
false

Suppresses the warning message shown when appearance.useCombination is active.

appearance.useSortable

appearance.useSortable
Type
boolean
Default
true

Activates drag & drop sorting of child records.

appearance.showPossibleLocalizationRecords

appearance.showPossibleLocalizationRecords
Type
boolean

Show unlocalized records that exist in the original language but have not yet been translated.

appearance.enabledControls

appearance.enabledControls
Type
object

Enables or disables individual controls on child records. Available keys with their defaults:

info (bool, default true)
Show or hide the info control.
new (bool, default true)
Show or hide the "new" control.
dragdrop (bool, default true)
Show or hide the drag & drop handle.
sort (bool, default false)
Show or hide the sort arrows.
hide (bool, default true)
Show or hide the hide/show toggle.
delete (bool, default true)
Show or hide the delete control.
localize (bool, default true)
Show or hide the localize control.

Example:

appearance:
  enabledControls:
    sort: true
    delete: false
Copied!

appearance.showPossibleRecordsSelector

appearance.showPossibleRecordsSelector
Type
boolean

Hides the foreign record selector from the interface even when foreign_selector is configured. Useful when replacing the selector with a custom control via customControls.

appearance.elementBrowserEnabled

appearance.elementBrowserEnabled
Type
boolean

Shows or hides the element browser button in inline records.

foreign_table

foreign_table
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.

foreign_field

foreign_field
Type
string (field)

It is possible to override the field name pointing to the parent record. Per default it is called foreign_table_parent_uid. This corresponds with the TCA option foreign_field.

shareAcrossTables

shareAcrossTables
Type
boolean
Default
false

Allows to reference a Record Type across multiple tables, if foreign_table is used.

Make sure to add this to every Collection, which shares the foreign_table.

This will create a new field called tablenames. It corresponds to the TCA option foreign_table_field. The field name can be overridden by defining foreign_table_field explicitly.

For examples visit this section

shareAcrossFields

shareAcrossFields
Type
boolean
Default
false

Allows to reference a Record Type across multiple fields, if foreign_table is used.

Make sure to add this to every Collection, which shares the foreign_table.

This will create a new field called fieldname. It corresponds to the TCA option foreign_match_fields.

For examples visit this section

allowedRecordTypes

allowedRecordTypes
Type
array
Default
[]

This option allows you to restrict possible record types for the type selector of the child record. The order of definition is used to sort the items. The first item in the list will always be the default type.

allowedRecordTypes:
  - text
  - images
Copied!

autoSizeMax

autoSizeMax
Type
integer

The inline field will never grow larger than this number of items before a scrollbar appears.

behaviour.allowLanguageSynchronization

behaviour.allowLanguageSynchronization
Type
boolean
Default
false

Allows to select if localization uses custom or default language value.

behaviour.disableMovingChildrenWithParent

behaviour.disableMovingChildrenWithParent
Type
boolean
Default
false

Disables automatic moving of child records when the parent record is moved.

behaviour.enableCascadingDelete

behaviour.enableCascadingDelete
Type
boolean
Default
true

When disabled, child records are not deleted when the parent record is deleted.

customControls

customControls
Type
array

A list of custom controls (user functions) used to extend the inline field interface. Each entry requires a userFunc key.

fieldControl

fieldControl
Type
object

fieldInformation

fieldInformation
Type
object

fieldWizard

fieldWizard
Type
object

filter

filter
Type
array

Defines filters for item values. Each entry requires a userFunc key and an optional parameters object. Does not work in combination with a wizard.

foreign_default_sortby

foreign_default_sortby
Type
string

ORDER BY clause for sorting child records when foreign_sortby is not defined.

foreign_label

foreign_label
Type
string

Field name of the child record to use as the inline element title.

foreign_match_fields

foreign_match_fields
Type
object

Field-value pairs inserted into and matched against when writing/reading IRRE relations. Allows reusing the same child table across multiple parent fields.

foreign_selector

foreign_selector
Type
string

Field name of the child record used as a selector to show all possible related records.

foreign_sortby

foreign_sortby
Type
string

Field on the child record that stores the manual sort order.

foreign_table_field

foreign_table_field
Type
string

Field on the child record pointing to the parent table name. Used together with shareAcrossTables.

foreign_unique

foreign_unique
Type
string

Field on the child record that must be unique across all children of a parent record.

MM

MM
Type
string

Table name for storing the MM relation. Used together with foreign_table.

MM_opposite_field

MM_opposite_field
Type
string

Enables bidirectional MM relations. Set to the field name on the local side when configuring the foreign side.

overrideChildTca

overrideChildTca
Type
object

Overrides TCA configuration of child records (e.g. sys_file_reference) attached to this field.

readOnly

readOnly
Type
boolean
Default
false

Renders the field in a way that the user can see the value but cannot edit it.

size

size
Type
integer
Default
1

Number of visible rows in the inline field.

symmetric_field

symmetric_field
Type
string

Works like foreign_field for bidirectional symmetric relations. Defines the field storing the uid of the "other" parent.

symmetric_label

symmetric_label
Type
string

Overrides the label defined in labelField when viewing a symmetric relation from the other side.

symmetric_sortby

symmetric_sortby
Type
string

Works like foreign_sortby for bidirectional symmetric relations.

overrideType

overrideType
Type
array
Default
[]

Type Overrides can be used to override the Record Definition in the context of as single field. This option only makes sense, if you don't define fields, but an external foreign_table, that you want to override. Refer to the API documentation if you want to learn more.

name: friendsoftypo3/example
table: tx_friendsoftypo3_example
prefixFields: false
labelField: title
fields:
  -
    identifier: title
    type: Text
    label: Title
  - identifier: collection_override
    type: Collection
    foreign_table: tx_hov_domain_model_record1
    overrideType:
      record1:
        - identifier: type
          type: Select
          useExistingField: true
        - identifier: title
          type: Text
          useExistingField: true
        - identifier: custom_field
          type: Text
Copied!

Example 

Minimal 

name: example/collection
fields:
  - identifier: collection
    type: Collection
    labelField: text
    fields:
      - identifier: text
        type: Text
Copied!

Advanced / use case 

name: example/collection
fields:
  - identifier: slides
    type: Collection
    labelField: title
    maxitems: 5
    minitems: 1
    appearance:
      collapseAll: true
      levelLinksPosition: both
    fields:
      - identifier: image
        type: File
        minitems: 1
        maxitems: 1
      - identifier: title
        type: Text
Copied!

This custom table my_slide needs to be defined as a Record Type in order to be used as a foreign table in slides.

name: example/slide
table: my_slide
labelField: title
fields:
  - identifier: title
    type: Text
  - identifier: image
    type: File
Copied!
name: example/collection
fields:
  - identifier: slides
    type: Collection
    foreign_table: my_slide
    shareAcrossTables: true
    shareAcrossFields: true
Copied!