Bug #88452
openTCA field type inline ignores l10n_mode "exclude"
0%
Description
- Add a field of type "inline" with l10n_mode="exclude" and l10n_display="defaultAsReadonly" to the TCA of a table with translation stuff (languageField, origUid ...)
- Set the foreign_table and foreign_field of the new field to a table without translation stuff (e.g. a table of participants with relations to a fe_user)
- Open a new or existing record of the table with the new inline field and add one or more inline records (e.g. participants)
- Save the record and create a translation of it
- Watch the normaly viewed and still editable inline records inside the translated record
As far as I understood the TCA manual, l10n_mode="exclude" together with l10n_display="defaultAsReadonly" should prevent, that a record added in the default view whould be editable in a translated record, which is currently not the case.
In addition, which is even worse in my eyes, everytime this record is saved over the backend, a new "translated" (without any translation fields) record of the inlined table with the foreign_field value of the translated record will be created and if a record of this kind already exists this will be marked as deleted. This delete and recreated happens after every save button press, which results in table entries like this:
uid pid education fe_user flag1 flag2 deleted hidden tstamp crdate cruser_id
1 51 1138 1424 1 0 0 0 1559057912 1559055866 1
2 51 1139 1424 1 0 1 0 1559056513 1559055866 1
3 51 1139 1424 1 0 1 0 1559056559 1559056513 1
4 51 1139 1424 1 0 1 0 1559056590 1559056559 1
5 51 1139 1424 1 0 1 0 1559057892 1559056590 1
6 51 1139 1424 0 0 1 0 1559057912 1559057892 1
7 51 1139 1424 0 0 0 0 1559057912 1559057912 1
1138 is the uid of the default parent record, 1139 is the uid of the translated record. "flag1" is a value which is changed in the translated parent record, which should not be possible (defaultAs*Readonly*).
Additional a change in the "flag1" field applied over the default parent record will be not transfered to it's translated record (which btw. should actually not exists).
Updated by Alexander Grein over 5 years ago
After adding translation stuff to my participant table, which would not be necessary if defaultAsReadonly would work like expected, I ran into the next problem with a field of type "group".
This is the definition of a relation field to fe_users, which should only be readable in the translated version of the record:
'fe_user' => [ 'exclude' => true, 'l10n_mode' => 'exclude', 'l10n_display' => 'defaultAsReadonly', 'label' => 'User', 'config' => [ 'type' => 'group', 'internal_type' => 'db', 'allowed' => 'fe_users', 'size' => 1, 'maxitems' => 1, ], ],
After adding a fe_user in the default record and selecting/generating the translated record I get this exceptions:
Warning: count(): Parameter must be an array or an object that implements Countable in /app/public/typo3/sysext/backend/Classes/Form/Element/GroupElement.php on line 131 Warning: Invalid argument supplied for foreach() in /app/public/typo3/sysext/backend/Classes/Form/Element/GroupElement.php on line 170
So it seem, also fields of type "group" have a problem with l10n_display "defaultAsReadonly".
BTW: A "normal" singleSelect don't have this kind of problems, but this is really unhandy in my case, because there are several thousands of fe_users in the db ;-)
After playing around with the different renderModes of a select type field, I found this definition usefull, because it also contains a search form and – hooray –, the l10n display readonly stuff also works:
'fe_user' => [ 'exclude' => true, 'l10n_mode' => 'exclude', 'l10n_display' => 'defaultAsReadonly', 'label' => 'LLL:EXT:bodyarteducation/Resources/Private/Language/locallang_db.xlf:tx_bodyarteducation_domain_model_participant.fe_user', 'config' => [ 'type' => 'select', 'renderType' => 'selectMultipleSideBySide', 'enableMultiSelectFilterTextfield' => true, 'foreign_table' => 'fe_users', 'minitems' => 1, 'maxitems' => 1, ], ],
Updated by Ioulia Kondratovitch over 5 years ago
I can confirm the issue with
"inline" with l10n_mode="exclude" and l10n_display="defaultAsReadonly"
After the upgrade 7 > 9 the whole custom stuff with this settings was broken and needed a temporarily alternative solution and a complex migration of data
Updated by Markus Klein about 5 years ago
- Related to Bug #89271: Inline (IRRE) records are not kept in sync on record save added
Updated by Vladimir Falcon over 3 years ago
I can confirm this problem in TYPO3 V9.5.26.
The fields types inline and group n:m with MM relations do not respect 'l10n_mode' => 'exclude' setting