Define type of child record
I would like to propose a new IRRE feature which allows to define the type of the foreign record created by IRRE.
Let me explain by taking two real-world examples from the Party Information Framework:
1. A party can have 0..n names. Each name has a type (either "person name" or "organisation name"). The type defines which fields are available for input, using the regular type-definition of TCA.
2. A party can have 0..n images. The same is true for addresses. Each image also has a type (either "party image" or "address image").
The feature request: As soon as the slave record is created by IRRE, the proper type is already selected (and not changeable). Only the fields for the selected type (according to TCA) are displayed.
I propose a new TCA attribute, e.g. 'foreign_type', which might look as follows:
$TCA['tx_party_parties']['columns']['names']['config'] = array(
'foreign_type' => array(
'0' => '0', // Party type = 0 (Person) => Name type = 0 (Person name)
'1' => '1', // Party type = 1 (Org.) => Name type = 1 (Org.name)
$TCA['tx_party_parties']['columns']['images']['config'] = array(
'foreign_type' => 0, // Always "Party image"
$TCA['tx_party_addresses']['columns']['images']['config'] = array(
'foreign_type' => 1, // Always "Address image"
So the general rule is:
1. If the 'foreign_type' is an array, then the array is a mapping from "Type of master table" to "Type of slave table".
2. Else it is the type of the slave table, regardless of the type of the master.
See Thread in the IRRE Newslist:
(issue imported from #M5300)