Bug #92604
openTranslation of child elements connected to a page record currently broken
0%
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.
Updated by Jo Hasenau about 4 years ago
- Is duplicate of Bug #78743: Wrong translation behavior for pages/pages_language_overlay added
Updated by Jo Hasenau about 4 years ago
- Is duplicate of Bug #81346: Datahandler command localize doesn't copy relations when localizing a page added
Updated by Jo Hasenau about 4 years ago
Especially the broken L10nmgr behaviour points out the actual source of the problem: We've only got the process_datamap() call within the localize process for pages, so the call to copyRecord_procBasedOnFieldType, which will be invoked for any other translatable table before calling process_datamap(), is completely missing.
Still process_cmdmap() usually takes care of creating all the necessary copies throughout the whole structure of parent records, children and grandchildren during a "non translation" copy action.
So the L10nmgr just triggers a single translation of the file reference itself and then fills in the translated content, while the "uid_foreign" field will still point to the original parent record of the default language.
Updated by Jo Hasenau about 4 years ago
- Category changed from Localization to DataHandler aka TCEmain
Updated by Jo Hasenau about 4 years ago
A first test with a patched core revealed that the problem can be eliminated by removing the if/else check and treating the table "pages" just as any other translatable table.
All references - in our case the "media" field and another "nav_icon" field of the introduction package - were translated properly.
Updated by Jo Hasenau about 4 years ago
- Subject changed from Translation of child elements together with the page record currently broken to Translation of child elements connected to a page record currently broken
Updated by Jo Hasenau about 4 years ago
BTW: The original check was
if ($Ttable === $table) {}
This was only there to have a difference between translations to the same table and translation to a second table, which was the case for pages and tt_products only but never used by anybody else IIRC.
Since this option has been removed and there is no pages_language_overlay anymore, we should have dropped that check completely instead of changing it to
if ($table !== 'pages') {}
Updated by Benni Mack about 4 years ago
- The "pid" needs to be the same (= the parent page ID) (which, I guess should not matter in your case)
- The "sorting" will be the same as the page in default language
Have you removed the if() condition already and checked if all DataHandler tests still work as expected?
Updated by Jo Hasenau about 4 years ago
So we would need some overrideValues to ensure the correct behaviour which should be done in the copyRecord method before calling process_datamap() then.
The "patch" was just an idea and a quick and dirty try - no real tests done on that yet, but will of course be done before pushing a patch to Gerrit.
Updated by Gerrit Code Review about 4 years ago
- Status changed from New to Under Review
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review about 4 years ago
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/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 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/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 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/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 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/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 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/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 years ago
Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 years ago
Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 years ago
Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 years ago
Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 years ago
Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 years ago
Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 years ago
Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 years ago
Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Gerrit Code Review almost 4 years ago
Patch set 19 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66213
Updated by Benni Mack almost 4 years ago
- Status changed from Under Review to Accepted
Updated by Christian Kuhn 10 months ago · Edited
- Status changed from Accepted to Closed
closed as dupe of #92604
Updated by Felix Nagel 10 months ago
@Christian Kuhn Closed as duplicate of itself?
Updated by Riccardo De Contardi 10 months ago
- Status changed from Closed to Accepted
Updated by Christian Kuhn 9 months ago
Oops ... I of course meant I closed #81346 as dupe of this one ..
Updated by Gerrit Code Review 9 months ago
- Status changed from Accepted to Under Review
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83001
Updated by Christian Kuhn 9 months ago
- Related to Task #79610: Cache results in doesRecordExist_pageLookUp added
Updated by Christian Kuhn 9 months ago
- Related to Task #103172: Avoid runtime caching pages in DataHandler added