Skip to content

Commit

Permalink
[BUGFIX] copyToLanguage with nested elements
Browse files Browse the repository at this point in the history
when adding support for v13 condition with t3_origuid in
datahandler hook was removed because TYPO3 dropped t3_origuid field

this patch readds condition with l10n_source field instead of t3_origuid field

Fixes: #572
  • Loading branch information
achimfritz committed Jan 18, 2025
1 parent 9d29e35 commit b610867
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ protected function newElementAfterContainer(array $incomingFieldArray): array
if ((int)$record['uid'] === (int)($incomingFieldArray['tx_container_parent'] ?? 0)) {
return $incomingFieldArray;
}
if (($record['l10n_source'] ?? 0) > 0 && (int)$record['l10n_source'] === (int)($incomingFieldArray['tx_container_parent'] ?? 0)) {
return $incomingFieldArray;
}
if ((int)($incomingFieldArray['tx_container_parent'] ?? 0) > 0 &&
(GeneralUtility::makeInstance(DatahandlerProcess::class))->isContainerInProcess((int)$incomingFieldArray['tx_container_parent'])
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,22 @@ public function localizeChildAfterContainerChild(): void
$this->dataHandler->process_cmdmap();
self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeChildAfterContainerChildResult.csv');
}

/**
* @test
*/
public function localizeWithNestedElements(): void
{
$this->importCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElements.csv');
$cmdmap = [
'tt_content' => [
1 => [
'copyToLanguage' => 4,
],
],
];
$this->dataHandler->start([], $cmdmap, $this->backendUser);
$this->dataHandler->process_cmdmap();
self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElementsResult.csv');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"tt_content"
,"uid","pid","CType","header","sorting","sys_language_uid","colPos","tx_container_parent","l18n_parent","l10n_source"
,"1","1","b13-2cols-with-header-container","container-1","256","0","0","0","0","0"
,"2","1","b13-2cols-with-header-container","container-2","512","0","201","1","0","0"
,"3","1","header","child-2-1","768","0","201","2","0","0"
,"4","1","header","child-2-2","1024","0","201","2","0","0"
"pages"
,"uid","pid","title","sys_language_uid","l10n_parent"
,"1","0","page-1","0","0"
,"2","0","page-1-language-1","1","1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"tt_content"
,"uid","pid","CType","header","sorting","sys_language_uid","colPos","tx_container_parent","l18n_parent","l10n_source"
,"1","1","b13-2cols-with-header-container","container-1","256","0","0","0","0","0"
,"2","1","b13-2cols-with-header-container","container-2","512","0","201","1","0","0"
,"3","1","header","child-2-1","768","0","201","2","0","0"
,"4","1","header","child-2-2","1024","0","201","2","0","0"
,"5","1","b13-2cols-with-header-container","[Translate to English-Free:] container-1","1280","4","0","0","0","1"
,"6","1","b13-2cols-with-header-container","[Translate to English-Free:] container-2","1536","4","201","5","0","2"
,"8","1","header","[Translate to English-Free:] child-2-1","1664","4","201","6","0","3"
,"7","1","header","[Translate to English-Free:] child-2-2","1792","4","201","6","0","4"

0 comments on commit b610867

Please sign in to comment.