Bug #73609

Creating IRRE child element without language of parent element

Added by Oliver Hader over 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
Start date:
2016-02-22
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Scenario:
  • localized IRRE parent element
  • create a new child element
Expectation:
  • child element automatically gets language of parent element assigned

Related issues

Related to TYPO3 Core - Bug #71596: New Inline records can not be created in translated parent record Closed 2015-11-16
Related to TYPO3 Core - Bug #76048: IRRE: Child records - New record doesn't get language of parent (non localized records but using new button) Closed 2016-05-04
Related to TYPO3 Core - Feature #60026: Set explicitly 'readOnly' sys_language_uid of child to value, taken from parent record New 2014-07-01
Related to TYPO3 Core - Bug #82330: cant create inline records if ctrl > enablecolumns > endtime is not specified in childrens TCA Closed 2017-09-07

Associated revisions

Revision c4c2ae46 (diff)
Added by Nicole Cordes over 2 years ago

[BUGFIX] Set language uid for inline children by default

On creating child records for an inline field, currently no language
is set and the children are stored with sys_language_uid 0. This patch
adds the proper configuration to ensure a default children language
according to its parent language.

Resolves: #48883
Resolves: #76048
Resolves: #73609
Releases: master, 7.6
Change-Id: Id9e449dbb06fed11670eedec45a92529fb4acb6f
Reviewed-on: https://review.typo3.org/52061
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Tobi Kretschmann <>
Reviewed-by: Frank Nägler <>
Reviewed-by: Nicole Cordes <>
Tested-by: Nicole Cordes <>

Revision d9e99922 (diff)
Added by Nicole Cordes over 2 years ago

[FOLLOWUP][BUGFIX] Set language uid for inline children by default

Resolves: #48883
Resolves: #76048
Resolves: #73609
Releases: master, 7.6
Change-Id: Id782bd41bfe30d9f9574e4b444d6e361ac76d0c6
Reviewed-on: https://review.typo3.org/52148
Reviewed-by: Wouter Wolters <>
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

Revision 9d3aa861 (diff)
Added by Susanne Moog almost 2 years ago

[BUGFIX] Set language uid for inline children by default

On creating child records for an inline field, currently no language
is set and the children are stored with sys_language_uid 0. This patch
adds the proper configuration to ensure a default children language
according to its parent language.

Resolves: #48883
Resolves: #76048
Resolves: #73609
Releases: master, 7.6
Change-Id: Id9e449dbb06fed11670eedec45a92529fb4acb6f
Reviewed-on: https://review.typo3.org/53206
Tested-by: TYPO3com <>
Reviewed-by: Benni Mack <>
Reviewed-by: Susanne Moog <>
Tested-by: Susanne Moog <>
Reviewed-by: Tymoteusz Motylewski <>
Tested-by: Tymoteusz Motylewski <>

History

#1 Updated by Ralf Merz over 3 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.

#2 Updated by Ralf Merz over 3 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?

#3 Updated by Ralf Merz over 3 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

#4 Updated by Tymoteusz Motylewski over 2 years ago

  • Category changed from FormEngine aka TCEforms to Localization
  • Target version set to 8 LTS

#5 Updated by Thorsten Kahler over 2 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.

#6 Updated by Thorsten Kahler over 2 years ago

IMO this will be solved with https://review.typo3.org/52061.

#7 Updated by Gerrit Code Review over 2 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

#8 Updated by Gerrit Code Review over 2 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

#9 Updated by Gerrit Code Review over 2 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

#10 Updated by Gerrit Code Review over 2 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

#11 Updated by Gerrit Code Review over 2 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

#12 Updated by Nicole Cordes over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#13 Updated by Gerrit Code Review over 2 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

#14 Updated by Nicole Cordes over 2 years ago

  • Status changed from Under Review to Resolved

#15 Updated by Viktor Livakivskyi about 2 years ago

  • Related to Feature #60026: Set explicitly 'readOnly' sys_language_uid of child to value, taken from parent record added

#16 Updated by Tymoteusz Motylewski almost 2 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

#17 Updated by Bjoern Jacob almost 2 years ago

Why was the mentioned patch not merged into v8 but master and v7?

#18 Updated by David Frerich almost 2 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.

#19 Updated by Mathias Brodala almost 2 years ago

  • Related to Bug #82330: cant create inline records if ctrl > enablecolumns > endtime is not specified in childrens TCA added

#20 Updated by Riccardo De Contardi over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF