Project

General

Profile

Actions

Bug #92604

open

Translation of child elements connected to a page record currently broken

Added by Jo Hasenau over 3 years ago. Updated about 1 month ago.

Status:
Under Review
Priority:
Must have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
Start date:
2020-10-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

This bug had been reported with CMS 8 already but was rejected because it was reported in conjunction with pages_language_overlay, but actually the same problem still exists.

The localize method of the DataHandler does not call the same copy action for pages as it does for any other table, that's why any record connected via an inline field will not be translated properly.

        if ($table !== 'pages') {
            // Get the uid of record after which this localized record should be inserted
            $previousUid = $this->getPreviousLocalizedRecordUid($table, $uid, $row['pid'], $language);
            // Execute the copy:
            $newId = $this->copyRecord($table, $uid, -$previousUid, true, $overrideValues, '', $language);
            $autoVersionNewId = $this->getAutoVersionId($table, $newId);
            if ($autoVersionNewId !== null) {
                $this->triggerRemapAction($table, $newId, [$this, 'placeholderShadowing'], [$table, $autoVersionNewId], true);
            }
        } else {
            // Create new page which needs to contain the same pid as the original page
            $overrideValues['pid'] = $row['pid'];
            // Take over the hidden state of the original language state, this is done due to legacy reasons where-as
            // pages_language_overlay was set to "hidden -> default=0" but pages hidden -> default 1" 
            if (!empty($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'])) {
                $hiddenFieldName = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
                $overrideValues[$hiddenFieldName] = $row[$hiddenFieldName] ?? $GLOBALS['TCA'][$table]['columns'][$hiddenFieldName]['config']['default'];
            }
            $temporaryId = StringUtility::getUniqueId('NEW');
            $copyTCE = $this->getLocalTCE();
            $copyTCE->start([$table => [$temporaryId => $overrideValues]], [], $this->BE_USER);
            $copyTCE->process_datamap();
            // Getting the new UID as if it had been copied:
            $theNewSQLID = $copyTCE->substNEWwithIDs[$temporaryId];
            if ($theNewSQLID) {
                $this->copyMappingArray[$table][$uid] = $theNewSQLID;
                $newId = $theNewSQLID;
            }

Currently this has been kind of hidden by giving i.e. the media field of the pages table an additional behaviour "allowLanguageSynchronization = true".

But this obviously just replaces the automatic creation of translated children with a manual process of adding new references.
This again contradicts the principles of the "connected mode", since the child records of translated pages will not get a proper translation parent this way.

Disabling that "allowLanguageSynchronization" behaviour will not create the original core behaviour as it is known from i.e. the tt_content media field, but will just create an empty field value.

Trying the same with the L10nmgr, which actually correctly exports the sys_file_reference will create an additional reference to the default language page record instead of creating a new one in the target language during the import.


Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Task #79610: Cache results in doesRecordExist_pageLookUpClosedThomas Hohn2017-02-03

Actions
Related to TYPO3 Core - Task #103172: Avoid runtime caching pages in DataHandlerResolved2024-02-21

Actions
Is duplicate of TYPO3 Core - Bug #78743: Wrong translation behavior for pages/pages_language_overlayRejected2016-11-18

Actions
Is duplicate of TYPO3 Core - Bug #81346: Datahandler command localize doesn't copy relations when localizing a pageClosed2017-05-26

Actions
Actions

Also available in: Atom PDF