Relation 

The Relation type can handle relations to other record types. They will be available to select from the Record Selector.

Settings 

Name Type Default Required
string (table name, comma-separated) true
integer
integer
string oneToMany
integer
boolean false
string|integer
array
object
object
object
object
array
string
boolean
boolean
boolean
boolean
string
object
string
object
string
boolean false
boolean
boolean false
integer 1
object

allowed

allowed
Type
string (table name, comma-separated)
Required

true

One or more tables, that should be referenced.

This table can be defined by another Content Block, but can also be an existing table defined by the Core or another extension.

maxitems

maxitems
Type
integer

Maximum number of items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer

Minimum number of items. Default is no minimum. JavaScript record validation prevents the record from being saved if the limit is not satisfied. The field can be set as required by setting minitems to at least 1.

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.

autoSizeMax

autoSizeMax
Type
integer

The field will never grow larger than this number of visible rows.

behaviour.allowLanguageSynchronization

behaviour.allowLanguageSynchronization
Type
boolean
Default
false

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

default

default
Type
string|integer

Default value set if a new record is created.

dontRemapTablesOnCopy

dontRemapTablesOnCopy
Type
array

A list of tables which should not be remapped to the new element uids if the field holds elements that are copied in the session.

elementBrowserEntryPoints

elementBrowserEntryPoints
Type
object

Changes the default starting point when opening the element browser. Use the key _default to set the default page uid.

Example:

elementBrowserEntryPoints:
  _default: 42
Copied!

fieldControl

fieldControl
Type
object

Enables or disables individual controls next to the field. Each control accepts a disabled boolean. Available controls: addRecord, editPopup, listModule, elementBrowser, insertClipboard.

See TCA fieldControl.

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_table

foreign_table
Type
string

Restricts selectable records to a specific table. Can be used instead of or together with allowed.

hideDeleteIcon

hideDeleteIcon
Type
boolean

Removes the delete icon next to the selector box.

hideMoveIcons

hideMoveIcons
Type
boolean

Removes the move icons next to the selector box.

hideSuggest

hideSuggest
Type
boolean

Disables the suggest (autocomplete) wizard.

localizeReferencesAtParentLocalization

localizeReferencesAtParentLocalization
Type
boolean

Defines whether referenced records should be localized when the current record gets localized. Only applies if references are not stored using MM tables.

MM

MM
Type
string

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

MM_match_fields

MM_match_fields
Type
object

Field-value pairs to both insert and match against when writing/reading MM relations.

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.

MM_oppositeUsage

MM_oppositeUsage
Type
object

Required on the opposite side of a bidirectional MM relation that uses match fields.

MM_table_where

MM_table_where
Type
string

Additional WHERE clause used when reading MM relations.

multiple

multiple
Type
boolean
Default
false

Allows the same record to be selected more than once in the list.

prepend_tname

prepend_tname
Type
boolean

When enabled, the table name is prepended to the stored relation uids.

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 selector box. A value of 1 displays a drop-down.

suggestOptions

suggestOptions
Type
object

Configuration for the suggest (autocomplete) wizard. Keys are table names or default to apply to all tables. Each entry supports:

additionalSearchFields (string)
Comma-separated list of extra fields to search in.
addWhere (string)
Additional WHERE clause appended to the search query.
cssClass (string)
CSS class added to every result list item.
maxItemsInResultList (integer, default 10)
Maximum number of results to display.
maxPathTitleLength (integer)
Maximum characters shown for a path element.
minimumCharacters (integer)
Minimum characters required to trigger the search.
orderBy (string)
ORDER BY clause for the search query.
pidList (string)
Comma-separated page uids to limit the search scope.
pidDepth (integer)
Number of sub-page levels to expand from pidList.
receiverClass (string)
Alternative PHP receiver class for the suggest wizard.
renderFunc (string)
User function to manipulate the displayed results.
searchCondition (string)
Additional WHERE clause (not prepended with AND).
searchWholePhrase (boolean)
Searches for the whole phrase rather than only the beginning.

Example:

suggestOptions:
  default:
    additionalSearchFields: 'nav_title, url'
    addWhere: 'AND pages.doktype = 1'
    minimumCharacters: 2
Copied!

Examples 

Minimal 

name: example/relation
fields:
  - identifier: record_select
    type: Relation
    allowed: 'some_table'
Copied!

Advanced / use case 

name: example/relation
fields:
  - identifier: page_select
    type: Relation
    allowed: 'pages'
    maxitems: 1
    suggestOptions:
      default:
        additionalSearchFields: 'nav_title, url'
        addWhere: 'AND pages.doktype = 1'
Copied!