Core API
4.2.15. ['columns'][fieldname]['config'] / TYPE: "inline"
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. This type was first integrated in TYPO3 4.1.
|
Key |
Datatype |
Description |
Scope |
|---|---|---|---|
|
type |
string |
[Must be set to "inline"] |
Display / Proc. |
|
foreign_table |
string (tablename) |
[Must be set, there is no type "inline" without a foreign table] See the other related options below. |
Display / Proc. |
|
appearance |
array |
Has information about the appearance of child-records, namely:
|
Display |
|
foreign_field |
string |
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. |
Display / Proc. |
|
foreign_label |
string |
If set, it overrides the label set in $TCA[<foreign_table>]['ctrl']['label'] for the inline-view. |
Display / Proc. |
|
foreign_selector |
string |
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. |
Display / Proc. |
|
foreign_sortby |
string |
Define a field on the child record (or on the intermediate table) that stores the manual sorting information. It is possible to have different sortings, depending from which side of the relation we look at parent or child. |
Display / Proc. |
|
foreign_default_sortby |
string |
If a fieldname 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. |
Display |
|
foreign_table_field |
string |
The foreign_table_field is the field of the child record pointing to the parent record. This defines where to store the tablename 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. |
Display / Proc. |
|
foreign_unique |
string |
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. |
Display / Proc. |
|
MM |
string (table name) |
Means that the relation to the records of "foreign_table" is done with a M-M relation with a third "join" table. That table typically has three columns:
The field which is configured as "inline" is not used for data-storage any more but rather it's set to the number of records in the relation on each update, so the field should be an integer. Notice: Using MM relations you can ONLY store real relations for foreign tables in the list - no additional string values or non-record values (so no attributes). |
Proc. |
|
size |
integer |
Height of the selector box in TCEforms. |
Display |
|
autoSizeMax |
integer |
If set, then the height of multiple-item selector boxes (maxitem > 1) will automatically be adjusted to the number of selected elements, however never less than "size" and never larger than the integer value of "autoSizeMax" itself (takes precedence over "size"). So "autoSizeMax" is the maximum height the selector can ever reach. |
Display |
|
maxitems |
integer > 0 |
Maximum number of items in the selector box. (Default = 1) |
Display / Proc |
|
minitems |
integer > 0 |
Minimum number of items in the selector box. (Default = 0) |
Display |
|
symmetric_field |
string |
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. |
Display / Proc. |
|
symmetric_label |
string |
If set, it overrides the label set in $TCA[<foreign_table>]['ctrl']['label'] for the inline-view and only if looking to a symmetric relation from the "other" side. |
Display / Proc. |
|
symmetric_sortby |
string |
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. |
Display / Proc. |
Example "comma separated list":
This combines companies with persons (employees) using a comma separated list, so no "foreign_field" is used here.
$TCA['company'] = Array(
'ctrl' => ...,
'interface' => ...,
'feInterface' => ...,
'columns' => Array(
'hidden' => ...,
'employees' => Array(
'exclude' => 1,
'label' => 'LLL:EXT:myextension/locallang_db.xml:company.employees',
'config' => Array(
'type' => 'inline',
'foreign_table' => 'person',
'maxitems' => 10,
'appearance' => Array(
'collapseAll' => 1,
'expandSingle' => 1,
),
),
),
),
'types' => ...
'palettes' => ...
);
Example "attributes on anti-symmetric intermediate table":
This example combines companies with persons (employees) using an intermediate table. It is also possible to add attributes to every relation � in this example, an attribute "jobtype" on the "person_company" table is defined. It is also possible to look at the relation from both sides (parent and child).
$TCA['person'] = Array(
'columns' => Array(
'employers' => Array(
'label' => 'LLL:EXT:myextension/locallang_db.xml:person.employers',
'config' => Array(
'type' => 'inline',
'foreign_table' => 'person_company',
'foreign_field' => 'person',
'foreign_label' => 'company',
),
),
),
);
$TCA['company'] = Array(
'columns' => Array(
'employees' => Array(
'label' => 'LLL:EXT:myextension/locallang_db.xml:company.employees',
'config' => Array(
'type' => 'inline',
'foreign_table' => 'person_company',
'foreign_field' => 'company',
'foreign_label' => 'person',
),
),
),
);
$TCA['person_company'] = Array(
'columns' => Array(
'person' => Array(
'label' => 'LLL:EXT:myextension/locallang_db.xml:person_company.person',
'config' => Array(
'type' => 'select',
'foreign_table' => 'person',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
),
),
'company' => Array(
'label' => 'LLL:EXT:myextension/locallang_db.xml:person_company.company',
'config' => Array(
'type' => 'select',
'foreign_table' => 'company',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
),
),
'jobtype' => Array(
'label' => 'LLL:EXT:myextension/locallang_db.xml:person_company.jobtype',
'config' => Array(
'type' => 'select',
'items' => Array(
Array('Project Manager (PM)', '0'),
Array('Chief Executive Officer (CEO)', '1'),
Array('Chief Technology Officer (CTO)', '2'),
),
'size' => 1,
'maxitems' => 1,
),
),
),
);
Example "attributes on symmetric intermediate table":
This example combines two persons with each other � imagine they are married. One person on the first side is the husband, and one person on the other side is the wife (or generally "spouse" in the example below). Symmetric relations combine object of the same with each other and it does not depend, from which side someone is looking to the relation � so the husband knows it's wife and the wife also know it's husband.
Sorting could be individually defined for each of the both sides (perhaps this should not be applied to a wife-husband-relationship in real life).
$TCA['person'] = Array(
'columns' => Array(
'employers' => Array(
'label' => 'LLL:EXT:myextension/locallang_db.xml:person.employers',
'config' => Array(
'type' => 'inline',
'foreign_table' => 'person_symmetric',
'foreign_field' => 'person',
'foreign_sortby' => 'sorting_person',
'foreign_label' => 'spouse',
'symmetric_field' => 'spouse',
'symmetric_sortby' => 'sorting_spouse',
'symmetric_label' => 'person',
),
),
),
);
$TCA['person_symmetric'] = Array(
'columns' => Array(
'person' => Array(
'label' => 'LLL:EXT:myextension/locallang_db.xml:person_symmetric.person',
'config' => Array(
'type' => 'select',
'foreign_table' => 'person',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
),
),
'spouse' => Array(
'label' => 'LLL:EXT:myextension/locallang_db.xml:person_symmetric.spouse',
'config' => Array(
'type' => 'select',
'foreign_table' => 'person',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
),
),
'someattribute' => Array(
'label' => 'LLL:EXT:myextension/locallang_db.xml:person_symmetric.someattribute',
'config' => Array(
'type' => 'input',
),
),
'sorting_person' => Array(
'config' => Array(
'type' => 'passthrough',
),
),
'sorting_spouse' => Array(
'config' => Array(
'type' => 'passthrough',
),
),
),
);
