Project

General

Profile

Actions

Bug #73609

closed

Creating IRRE child element without language of parent element

Added by Oliver Hader almost 9 years ago. Updated about 7 years ago.

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

100%

Estimated time:
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 4 (1 open3 closed)

Related to TYPO3 Core - Bug #71596: New Inline records can not be created in translated parent recordClosed2015-11-16

Actions
Related to TYPO3 Core - Bug #76048: IRRE: Child records - New record doesn't get language of parent (non localized records but using new button)ClosedJo Hasenau2016-05-04

Actions
Related to TYPO3 Core - Feature #60026: Set explicitly 'readOnly' sys_language_uid of child to value, taken from parent recordNew2014-07-01

Actions
Related to TYPO3 Core - Bug #82330: cant create inline records if ctrl > enablecolumns > endtime is not specified in childrens TCA Closed2017-09-07

Actions
Actions #1

Updated by Ralf Merz almost 9 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.

Actions #2

Updated by Ralf Merz almost 9 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?

Actions #3

Updated by Ralf Merz almost 9 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

Actions #4

Updated by Tymoteusz Motylewski about 8 years ago

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

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.

Actions #6

Updated by Thorsten Kahler over 7 years ago

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

Actions #7

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

Actions #8

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

Actions #9

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

Actions #10

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

Actions #11

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

Actions #12

Updated by Nicole Cordes over 7 years ago

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

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

Actions #14

Updated by Nicole Cordes over 7 years ago

  • Status changed from Under Review to Resolved
Actions #15

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
Actions #16

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

Actions #17

Updated by Björn Jacob over 7 years ago

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

Actions #18

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.

Actions #19

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
Actions #20

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF