Labels not displayed for group relations in pi_base extensions
https://review.typo3.org/35483 introduced a regression in 6.2.12
For fields of type "group", with "internal_type" = 'db' the labels aren't shown if only 'allowed' property is used to define the table for which the MM relation is made.
The new code assumes that 'foreign_table' is set, which is marked as "just a workaround for an extbase limitation" in TCA reference. Pi_base extension don't use that field and rely on the 'allowed' field to define the remote table. The old code worked fine for pi_base extensions, but apparently not for extbase extensions; with the new code this situation is the other way around.
#2 Updated by Markus Klein about 4 years ago
Can you post a sample TCA?
Already contains such a testcase, right?
$GLOBALS['TCA'] = array( 'index_config' => array( 'columns' => array( 'indexcfgs' => array( 'config' => array( 'type' => 'group', 'internal_type' => 'db', 'allowed' => 'index_config,pages', 'size' => 5, ), ), ), ), );
#3 Updated by Jigal van Hemert about 4 years ago
'category' => array( 'exclude' => 1, 'label' => 'LLL:EXT:extkey/locallang_db.xml:tx_extkey.category', 'config' => array( 'type' => 'group', 'internal_type' => 'db', 'allowed' => 'tx_extkey_cat', 'size' => 5, 'minitems' => 0, 'maxitems' => 100, 'MM' => "tx_extkey_category_mm", ) ),
adding a line 'foreign_table' => 'tx_extkey_cat', makes the category labels appear in the List module.
The new unit test doesn't have an 'MM' property set. Without 'MM' a different block of code is used which looks in $theColConf['allowed'].
If you look at the new code it explicitly uses $theColConf['foreign_table'] to get the name of the linked table, whereas the old code used $theColConf['allowed'].
allowed can contain a list of tables or '*' as a wildcard, so it is rather complicated to handle them exactly list the 'foreign_table' property of a 'select' field.
Looking at the differences and the definitions in TCAref. I suspect that the previous bugfix was done for extbase extensions since extbase uses 'foreign_table' to find the table name for a 'group' field.
We could easily copy 'allowed' to 'foreign_table' if the latter is empty, but for 'group' fields the options to have multiple foreign tables or a '*' wildcard must still be supported.