Story #69712: Further FormEngine development
IRRE: Child records - New record doesn't get language of parent (non localized records but using new button)
Since 7.6 if one adds a new record to an existing record which is not in the default language, the newly created child record will not receive the language of the parent record.
This is not a problem if the record is localized BUT:
1.) There might not be a language parent to the main record - record only exists in selected language
2.) It might be possible to add additional child records to those of the parent record
The commented out code here. Though I think with 7.6 we should move the code to a DataHandler.
I also don't think it helps if one creates a new record, changes it language and adds a child record prior to saving, see related issue.
Updated by Andreas Allacher over 4 years ago
Things that the old implementation didn't take care of:
1.) Setting the language to -1 for all wasn't transferred to childs, as the check was > 0, it should be != 0 or just set it always.
2.) Bug #63092
3.) Related to bug #63092: If one changes the language and creates a new child record prior to saving it will be created with the old langauge uid.
Updated by Jo Hasenau over 4 years ago
- Status changed from New to Accepted
- Assignee set to Jo Hasenau
-1 means "all", so this should not be transferred to children, since a parent element with that setting can contain children in any available language.
So the check should be > -1, since 0 should be transferred to children for example when switching back to the default language.
Updated by Tymoteusz Motylewski over 3 years ago
The backport to v7 has been merged (https://review.typo3.org/#/c/53206/)
1) Now NEW irre elements (including FAL relations) will get a sys_language_uid of their parent.
2) There is no automatic migration of the old record having inccorrect value in the sys_language_uid.
3) The issue has been solved on the FormEngine level, thus you need to make sure you have
sys_language_uid field in the showitem list in your TCA.
Often you don't want to show the sys_language field to the user, so there is a little trick, which will make stuff work without showing the field to the user.
You just need to create a hidden palette with sys_language_uid in it.
'showitem' = '... --palette--;;hiddenLanguagePalette,'; 'hiddenLanguagePalette' => [ 'showitem' => 'sys_language_uid, l10n_parent', 'isHiddenPalette' => true, ],
See TCA for sys_file_reference where this approach is used, or this pull request as a reference https://github.com/benjaminkott/bootstrap_package/pull/458