Bug #73609
closedCreating IRRE child element without language of parent element
Added by Oliver Hader over 8 years ago. Updated about 7 years ago.
100%
Description
- localized IRRE parent element
- create a new child element
- child element automatically gets language of parent element assigned
Updated by Ralf Merz over 8 years ago
Hi,
just to write down some thoughts and results of testing... It seems that the FormDataProviders always write an array into sys_language_uid and l10n_parent, which imo should be integers.
Updated by Ralf Merz over 8 years ago
Hi again,
ok, i could see for more fields that it seems to be ok to have arrays. If I compare a "add new file" to "add new content element", I could debug that the new content element gets the language_id set by its "neighbourRow", which is not the case for files though...
sys_file_reference gets the sys_language_uid set by the default value of TCA, which is "0".
How can this be changed so that the right value will be set?
Updated by Ralf Merz over 8 years ago
Hi,
new findings....
in FormInlineAjaxController after line 132, I added this one (mostly copied from synchronizeLocalizeAction():
$formDataCompilerInputForParent = [ 'vanillaUid' => (int)$parent['uid'], 'command' => 'edit', 'tableName' => $parent['table'], 'databaseRow' => [ // TcaInlineExpandCollapseState needs this 'uid' => (int)$parent['uid'], ], 'inlineFirstPid' => $inlineFirstPid, 'columnsToProcess' => [ $parentFieldName ], // @todo: still needed? NO! 'inlineStructure' => $inlineStackProcessor->getStructure(), // Do not compile existing children, we don't need them now 'inlineCompileExistingChildren' => false, ]; // Full TcaDatabaseRecord is required here to have the list of connected uids $oldItemList /** @var TcaDatabaseRecord $formDataGroup */ $formDataGroup = GeneralUtility::makeInstance(TcaDatabaseRecord::class); /** @var FormDataCompiler $formDataCompiler */ $formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup); $parentData = $formDataCompiler->compile($formDataCompilerInputForParent); $parentConfig = $parentData['processedTca']['columns'][$parentFieldName]['config']; $parentLanguageField = $parentData['processedTca']['ctrl']['languageField']; $parentLanguage = $parentData['databaseRow'][$parentLanguageField]; // DataHandler cannot handle arrays as field value if (is_array($parentLanguage)) { $parentLanguage = implode(',', $parentLanguage); $childData['databaseRow'][$parentLanguageField] = $parentLanguage; }
So this sets the sys_language_uid. But I cannot say if this would be good at this place. At least, the sys_file_reference record has the right sys_language_uid then.
Regards
merzilla
Updated by Tymoteusz Motylewski almost 8 years ago
- Category changed from FormEngine aka TCEforms to Localization
- Target version set to 8 LTS
Updated by Thorsten Kahler almost 8 years ago
Ralf Merz wrote:
in FormInlineAjaxController after line 132, I added this one (mostly copied from synchronizeLocalizeAction():
[...]
So this sets the sys_language_uid. But I cannot say if this would be good at this place. At least, the sys_file_reference record has the right sys_language_uid then.
The code should be wrapped into a FormDataProvider
. Additionally the InlineParentRecord
FormDataGroup has to read the existing parent record, i.e. FormDataProvider DatabaseEditRow
has to be added to the dependency chain. If not, method FormDataProvider\TcaInlineConfiguration::initializeLocalizationMode()
sets the localizationMode
to "none".
This solves #76048 as well. And it's just what the now commented out code in class FormInlineAjaxController
used to do.
Updated by Thorsten Kahler over 7 years ago
IMO this will be solved with https://review.typo3.org/52061.
Updated by Gerrit Code Review over 7 years ago
- Status changed from New to Under Review
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061
Updated by Gerrit Code Review over 7 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061
Updated by Gerrit Code Review over 7 years ago
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061
Updated by Gerrit Code Review over 7 years ago
Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061
Updated by Gerrit Code Review over 7 years ago
Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061
Updated by Nicole Cordes over 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset c4c2ae465ad11d7692d2c04e953f188f80b2bf35.
Updated by Gerrit Code Review over 7 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52148
Updated by Nicole Cordes over 7 years ago
- Status changed from Under Review to Resolved
Applied in changeset d9e9992259fe665932e6ba26954e52b4ceedeb7d.
Updated by Viktor Livakivskyi over 7 years ago
- Related to Feature #60026: Set explicitly 'readOnly' sys_language_uid of child to value, taken from parent record added
Updated by Tymoteusz Motylewski over 7 years ago
The backport to v7 has been merged (https://review.typo3.org/#/c/53206/)
Few notes:
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.
e.g.
'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
Updated by Björn Jacob over 7 years ago
Why was the mentioned patch not merged into v8 but master and v7?
Updated by David Frerich about 7 years ago
After this "fix" i get many 500 errors for Inline-Fields, because not all of them have a languageField.
Why is a languageField now mandatory? I don't think thats a good idea and tables without a languageField should be possible and respected.
Updated by Mathias Brodala about 7 years ago
- Related to Bug #82330: cant create inline records if ctrl > enablecolumns > endtime is not specified in childrens TCA added
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed