IRRE / inline

Changed in version 12.0

Inline fields should not be used anymore to handle files. Use the TCA column type file instead.

Inline-Relational-Record-Editing (IRRE) offers a way of directly editing parent-child-relations in one backend view. New child records are created using AJAX calls to prevent a reload of the complete backend view.

The type='inline' is a powerful element that can handle many types of relation, including simple 1:n and nested 1:n-1:n relations, aswell as m:n relations with different view aspects and localization setups. When combined with 'ctrl' and 'types' properties in the TCA a huge amount of different views are possible.

The inline type was mainly designed to handle 1:n relations, where one parent record has many children and each child has only one parent. Children can not be transferred from one parent to another.

However, m:n relations can be setup using intermediate tables. An m:n relation is where a child has many parents. In addition to the main parent-child relation fields in the intermediate table, fields can be added to attach additional information to the parent-child relation. One example of this is "FAL" / resource handling in the Core. A parent record (for instance table "tt_content") is connected via table "sys_file_reference" to a media resource in "sys_file". A sys_file record has table "sys_file_metadata" as a child record which holds meta information about the file (for instance a description). This information can be overwritten for the specific file resource used in "tt_content" by adding a new description in "sys_file_reference". There are inline and field properties in the TCA such as "placeholder" to set this up.

Properties of the TCA column type inline

Name Type Scope
array Display
integer Display
boolean Proc.
boolean Proc.
boolean Proc.
array Display
array Display / Proc.
string Display
string Display / Proc.
string Display / Proc.
array Proc.
string Display / Proc.
string Display / Proc.
string (table name) Display / Proc.
string Display / Proc.
string Display / Proc.
integer > 0 Display / Proc.
integer > 0 Display
string (table name) Proc.
string (field name) Proc.
array Display
integer Display
string Display / Proc.
string Display / Proc.
string Display / Proc.

Changed in version 12.0

The following properties have been removed:

  • [appearance][headerThumbnail]
  • [appearance][fileUploadAllowed]
  • [appearance][fileByUrlAllowed]

Use the TCA column type file to handle files.

appearance
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Has information about the appearance of child records, namely:

collapseAll (boolean)
Show all child records collapsed (if false, all are expanded)
expandSingle (boolean)
Show only one child record expanded each time. If a collapsed record is clicked, the currently open one collapses and the clicked one expands.
showNewRecordLink (boolean)
Disables the New record link in TCA inline elements without simultaneously disabling the + button in the header of each inline record (using ['appearance']['enabledControls']['new']).
newRecordLinkAddTitle (boolean)

Adds the title of the foreign_table to the "New record" link.

false
"Create new"
true
"Create new <title of foreign_table>", e.g. "Create new address"
newRecordLinkTitle (string or LLL reference)

Overrides the title of the "New record" link with a localized string. This will work only if newRecordLinkAddTitle is not set to true.

Example:

'newRecordLinkTitle' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xlf:my_new_record_label'
Copied!
createNewRelationLinkTitle (string or LLL reference)
Overrides the link text and title of the "Create new relation" button with a localised string. Only useful, if the element browser is enabled. This is usually used together with FAL relations to change it to "Add file" or similar.
levelLinksPosition (string)
Values: 'top' (default), 'bottom', 'both'. Defines where to show the "New record" link in relation to the child records. Value 'none' is no longer supported, use showAllLocalizationLink, showSynchronizationLink and showNewRecordLink with value false instead.
useCombination (boolean)
This is only useful on bidirectional relations using an intermediate table with attributes. In a "combination" it is possible to edit the attributes AND the related child record itself. If using a foreign_selector in such a case, the foreign_unique property must be set to the same field as the foreign_selector.
suppressCombinationWarning (boolean)

Suppresses the warning flash message that will be displayed when using useCombination. You can also override the message with your own message using the example below.

Example:

$GLOBALS['TCA']['tx_demo_domain_model_demoinline']['columns']['irre_records']['config'] = [
     'appearance' => [
        'overwriteCombinationWarningMessage' => 'LLL:EXT:demo/Resources/Private/Language/locallang_db.xlf:tx_demo_domain_model_demoinline.irre_records.useCombinationWarning',
        'useCombination' => TRUE
     ],
],
Copied!
useSortable (boolean)
Activate drag & drop.
showPossibleLocalizationRecords (boolean)
Show unlocalized records which are in the original language, but not yet localized.
showAllLocalizationLink (boolean)
Defines whether to show the "localize all records" link to fetch untranslated records from the original language.
showSynchronizationLink (boolean)
Defines whether to show a "synchronize" link to update to a 1:1 translation with the original language.
enabledControls (array)
Associative array with the keys 'info', 'new', 'dragdrop', 'sort', 'hide', 'delete', 'localize'. If the accordant values are set to a boolean value (true or false), the control is shown or hidden in the header of each record.
showPossibleRecordsSelector (boolean)
Can be used to hide the foreign record selector from the interface, even if you have a foreign_selector configured. This can be used to keep the technical functionality of the foreign_selector but is useful if you want to replace it with your own implementation using a custom control, see customControls.
elementBrowserEnabled (boolean)
Hides or displays the element browser button in inline records
autoSizeMax
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The maximum size (height) of the select field.

The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of autoSizeMax.

behaviour
allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

EXT:my_extension/Configuration/TCA/Overrides/someTable.php
<?php

$inlineField = [
    'config' => [
        'type' => 'inline',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!
disableMovingChildrenWithParent
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']
Scope
Proc.

Default false. Disables that child records get moved along with their parent records. Usually if in a parent-child relation a parent record is moved to a different page (eg. via cut+paste from clipboard), the children are relocated along with the parent. This flag disables the child move.

This property can be especially useful if all child records should be gathered in one storage folder and their parents are spread out at different places in the page tree. In combination with the Tsconfig setting TCAdefaults.<table>.pid = <page id> children can be forced to be created in this folder and stay there.

enableCascadingDelete
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']
Scope
Proc.

Default true. Usually in inline relations, if a parent is deleted, all children are deleted along with the parent. This flag can be used to disable that cascading delete. Example usage: A frontend user (parent) has assigned invoices (children). If a frontend user is deleted, it could be useful to keep the invoices.

customControls
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Numerical array containing definitions of custom header controls for IRRE fields. This makes it possible to create special controls by calling user-defined functions (userFuncs). Each item in the array item must be an array itself, with at least on key "userFunc" pointing to the user function to call.

The userFunc string is defined as usual in TYPO3 as ['class']->['method'], e.g.:

\Vendor\Extension\MyClass::class . '->myUserFuncMethod'
Copied!

For more details, see the implementation in TYPO3\\CMS\\Backend\\Form\\Container\\InlineControlContainer and search for "customControls".

filter
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Possibility to define user functions to filter out child items.

This is useful in special scenarios when used in conjunction with a foreign_selector where only certain foreign records are allowed to be related to.

For further documentation on this feature, see the "filter" documentation under TYPE: "group".

foreign_default_sortby
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

If a field name for foreign_sortby is defined, then this is ignored. Otherwise, this is used as the "ORDER BY" statement to sort the records in the table when listed.

foreign\_field
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

The foreign_field is the field of the child record pointing to the parent record. This defines where to store the uid of the parent record.

foreign_label
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Insert the fieldname of the inline element, that you want to have as the title of the inline element. E.g. 'header'. If set, it overrides the label set in $GLOBALS['TCA'][<foreign_table>]['ctrl']['label'] for the inline-view.

foreign_match_fields
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Array of field-value pairs to both insert and match against when writing/reading IRRE relations. Using the match fields, it is possible to re-use the same child table in more than one field of the parent table by using a match field with different values for each of the use cases.

Examples

Imagine you have a parent table called "company" and a child table called "persons". Now, if you want the company table to have two fields of type "inline", one called "employees" and one called "customers", both containing "persons". Then you could use a (hidden) field called "role" on the child (person) table to keep them apart. The match TCA configuration of the parent table would then look like this:

<?php

$GLOBALS['TCA']['ty_myext_company'] = [
    'columns' => [
        'employees' => [
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'ty_myext_person',
                'foreign_field' => 'company',
                'foreign_match_fields' => [
                    'role' => 'employee',
                ],
            ],
        ],
        'customers' => [
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'ty_myext_person',
                'foreign_field' => 'company',
                'foreign_match_fields' => [
                    'role' => 'customer',
                ],
            ],
        ],
    ],
];
Copied!

If the match field is made editable, for instance as a select drop-down of two values, the the relation would switch between the two parent fields after change an save. Imagine a user record having "open" and "closed" issues assigned, both pointing to the same table. The user then switches the status of an issue from "open" to "closed". On save, the issue would "move over" to the "closed" section in his view.

foreign_selector
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

A selector is used to show all possible child records that could be used to create a relation with the parent record. It will be rendered as a multi-select-box. On clicking on an item inside the selector a new relation is created. The foreign_selector points to a field of the foreign_table that is responsible for providing a selector-box – this field on the foreign_table usually is of type select and also has a foreign_table defined.

In most cases you must assign the field uid_local to the foreign_selector. This field name is used as a convention for the child record of the intermediate table. The automatic generation of MM tables also uses this field name. It depends whether uid_local of the MM table points to the opposite table (of the perspective of your inline field). In case of the opposite direction the field name uid_foreign is usually used.

foreign_sortby
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Define a field on the child record that stores the manual sorting information. It is possible to have a different sorting, depending from which side of the relation we look at parent or child.

This property requires that the foreign_field approach is used.

When using MM relations the field used on the intermediate table is hardcoded to sorting_foreign. Setting this property has no effect combined with an MM table.

foreign_table
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Required
true
Scope
Display / Proc.

The table name of the child records is defined here. The table must be configured in $GLOBALS['TCA'].

foreign_table_field
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

The foreign_table_field is the field of the child record pointing to the parent record. This defines where to store the table name of the parent record. On setting this configuration key together with foreign_field, the child record knows what its parent record is – so the child record could also be used on other parent tables. This issue is also known as "weak entity". Do not confuse with foreign_table or foreign_field. It has its own behavior.

foreign\_unique
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Field which must be unique for all children of a parent record.

Example

Say you have two tables, products, your parent table, and prices, your child table (products) can have multiple prices. The prices table has a field called customer_group, which is a selector box. Now you want to be able to specify prices for each customer group when you edit a product, but of course you don't want to specify contradicting prices for one product (i.e. two different prices for the same customer_group). That's why you would set foreign_unique to the field name "customer_group", to prevent that two prices for the same customer group can be created for one product.

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

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
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

New in version 11.4

TCA table column fields that define ['config']['MM'] can omit the specification of the intermediate MM table layout in ext_tables.sql. The TYPO3 database analyzer takes care of proper schema definition.

Extensions are strongly encouraged to drop CREATE TABLE definitions from the ext_tables.sql file for those intermediate tables referenced by TCA table columns. Dropping these definitions allows the Core to adapt and migrate definitions if needed.

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

This value contains the name of the table in which to store an MM relation. It is used together with foreign_table. The database field with a MM property only stores the number of records in the relation.

Please have a look into the additional information in the MM common property description.

MM_hasUidField (type => inline)
type

boolean

Scope

Proc.

If the multiple property is set with MM relations you must set this value to true and include a UID field. Otherwise, sorting and removing relations will be buggy.

MM_opposite_field
Type
string (field name)
Scope
Proc.

If you want to make a MM relation editable from the foreign side (bidirectional) of the relation as well, you need to set MM_opposite_field on the foreign side to the field name on the local side.

For example, if the field companies.employees is your local side and you want to make the same relation editable from the foreign side of the relation in a field called persons.employers, you would need to set the MM_opposite_field value of the TCA configuration of the persons.employers field to the string "employees".

MM_hasUidField

Examples

Example: Inline field with MM table configured
An inline field with MM relation
EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mm.php
[
    'columns' => [
        'inline_1' => [
            'label' => 'inline_1',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_mm_child',
                'MM' => 'tx_styleguide_inline_mm_child_rel',
                'MM_hasUidField' => true,
                'appearance' => [
                    'showSynchronizationLink' => 1,
                    'showAllLocalizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                ],
            ],
        ],
    ],
]
Copied!
Example: Opposite field to display MM relations two ways
An inline field with MM relation
EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mm_child.php
[
    'columns' => [
        'parents' => [
            'label' => 'parents',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_mm',
                'MM' => 'tx_styleguide_inline_mm_child_rel',
                'MM_hasUidField' => true,
                'MM_opposite_field' => 'inline_1',
                'maxitems' => 10,
                'appearance' => [
                    'showSynchronizationLink' => 1,
                    'showAllLocalizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                ],
            ],
        ],
    ],
]
Copied!
overrideChildTca
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

This property can be used to override certain aspects of the child's TCA if that child record is opened inline of the given parent. Display related TCA properties of the child table can be overridden in types and columns section.

See also Examples with overrideChildTca.

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Only useful in combination with foreign_selector.

If set to 1 (default), the combination box is a select drop-down, else a select box of given size.

symmetric_field
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

This works like foreign_field, but in case of using bidirectional symmetric relations. symmetric_field defines in which field on the foreign_table the uid of the "other" parent is stored.

Example
EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mnsymmetric.php
[
    'columns' => [
        'branches' => [
            'label' => 'branches',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_mnsymmetric_mm',
                'foreign_field' => 'hotelid',
                'foreign_sortby' => 'hotelsort',
                'foreign_label' => 'branchid',
                'symmetric_field' => 'branchid',
                'symmetric_sortby' => 'branchsort',
                'symmetric_label' => 'hotelid',
                'maxitems' => 10,
                'appearance' => [
                    'showSynchronizationLink' => 1,
                    'showAllLocalizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                ],
            ],
        ],
    ],
]
Copied!
symmetric_label
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

If set, it overrides the label set in $GLOBALS['TCA'][<foreign_table>]['ctrl']['label'] for the inline-view and only if looking to a symmetric relation from the "other" side.

symmetric_sortby
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

This works like foreign_sortby, but in case of using bidirectional symmetric relations. Each side of a symmetric relation could have its own sorting, so symmetric_sortby defines a field on the foreign_table where the sorting of the "other" side is stored. This property requires that the foreign_field approach is used.