Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion Classes/Hooks/Datahandler/CommandMapPostProcessingHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ class CommandMapPostProcessingHook
*/
protected $containerFactory;

public function __construct(ContainerFactory $containerFactory)
protected ContainerService $containerService;

public function __construct(ContainerFactory $containerFactory, ContainerService $containerService)
{
$this->containerFactory = $containerFactory;
$this->containerService = $containerService;
}

public function processCmdmap_postProcess(string $command, string $table, $id, $value, DataHandler $dataHandler, $pasteUpdate, $pasteDatamap): void
Expand All @@ -54,6 +57,19 @@ protected function localizeOrCopyToLanguage(int $uid, int $language, string $com
$last = $dataHandler->copyMappingArray['tt_content'][$uid] ?? null;
if ($command === 'copyToLanguage') {
$containerId = $last;
$pos = $this->containerService->getAfterContainerElementTarget($container);
// move next record after last child
$cmd = ['tt_content' => [$last => [
'move' => [
'target' => $pos,
'action' => 'paste',
'update' => [],
]
]]];
$localDataHandler = GeneralUtility::makeInstance(DataHandler::class);
$localDataHandler->enableLogging = $dataHandler->enableLogging;
$localDataHandler->start([], $cmd, $dataHandler->BE_USER);
$localDataHandler->process_cmdmap();
} else {
$containerId = $container->getUid();
}
Expand Down Expand Up @@ -132,6 +148,18 @@ protected function copyOrMoveChildren(int $origUid, int $newId, int $containerId
$localDataHandler->enableLogging = $dataHandler->enableLogging;
$localDataHandler->start([], $cmd, $dataHandler->BE_USER);
$localDataHandler->process_cmdmap();
if (!isset($origCmdMap['tt_content'][$origUid][$command]['update']['sys_language_uid'])) {
continue;
}
if ($origCmdMap['tt_content'][$origUid][$command]['update']['sys_language_uid'] === $record['sys_language_uid']) {
continue;
}
$target = -$record['uid'];
// copy case
$newId = $localDataHandler->copyMappingArray['tt_content'][$record['uid']] ?? null;
if ($newId !== null) {
$target = -$newId;
}
}
(GeneralUtility::makeInstance(DatahandlerProcess::class))->endContainerProcess($origUid);
} catch (Exception $e) {
Expand Down
11 changes: 3 additions & 8 deletions Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,14 @@ public function __construct(

protected function newElementAfterContainer(array $incomingFieldArray): array
{
if (isset($incomingFieldArray['sorting'])) {
return $incomingFieldArray;
}
$record = $this->database->fetchOneRecord(-(int)$incomingFieldArray['pid']);
if ($record === null) {
// new elements in container have already correct target
return $incomingFieldArray;
}
if ((int)$record['uid'] === (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'])
) {
return $incomingFieldArray;
}
if (!$this->tcaRegistry->isContainerElement($record['CType'])) {
return $incomingFieldArray;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function copyElementIntoContainerAtTopCopyAllowedCTypeElement(): void
*/
public function copyChildFromOtherContainerIntoColposWhereTargetElementInOtherColposHasRestrictionIsAllowd(): void
{
$this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/copy_child_from_other_container_into_colpos_where_target_element_in_other_colpos_has_restriction.csv');
$this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/CopyChildFromOtherContainerIntoColposWhereTargetElementInOtherColposHasRestrictionIsAllowed.csv');
$cmdmap = [
'tt_content' => [
73 => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
,"uid","pid","title"
,1,0,""
"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","",0,0,10,0,0,0
,2,1,"header","",0,0,200,1,0,0
,3,1,"bullets","",0,0,9,0,0,0
,4,1,"b13-2cols","",0,0,10,0,0,0
,5,1,"bullets","",0,0,200,4,0,0
,6,1,"b13-2cols-with-header-container"," (copy 1)",256,0,9,0,0,0
,7,1,"header"," (copy 2)",512,0,200,6,0,0
,"uid","pid","CType","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container",10,0
,2,1,"header",200,1
,3,1,"bullets",9,0
,4,1,"b13-2cols",10,0
,5,1,"bullets",200,4
,6,1,"b13-2cols-with-header-container",9,0
,7,1,"header",200,6
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
,"uid","pid","title"
,1,0,""
"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","",0,0,10,0,0,0
,2,1,"header","",0,0,200,1,0,0
,3,1,"bullets","",0,0,9,0,0,0
,4,1,"b13-2cols","",0,0,10,0,0,0
,5,1,"bullets","",0,0,200,4,0,0
,6,1,"b13-2cols"," (copy 1)",256,0,200,1,0,0
,7,1,"bullets"," (copy 2)",512,0,200,6,0,0
,"uid","pid","CType","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container",10,0
,2,1,"header",200,1
,3,1,"bullets",9,0
,4,1,"b13-2cols",10,0
,5,1,"bullets",200,4
,6,1,"b13-2cols",200,1
,7,1,"bullets",200,6
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
,1,0,""
,2,0,""
"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","",0,0,10,0,0,0
,2,1,"header","",0,0,200,1,0,0
,3,1,"bullets","",0,0,9,0,0,0
,4,1,"b13-2cols","",0,0,10,0,0,0
,5,1,"bullets","",0,0,200,4,0,0
,11,2,"b13-2cols-with-header-container","",128,0,0,0,0,0
,12,2,"header","",256,0,200,11,0,0
,13,2,"bullets","",512,0,201,11,0,0
,14,2,"b13-2cols-with-header-container"," (copy 1)",64,0,0,0,0,0
,15,2,"header"," (copy 2)",96,0,200,14,0,0
,16,2,"bullets"," (copy 3)",112,0,201,14,0,0
,"uid","pid","CType","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container",10,0
,2,1,"header",200,1
,3,1,"bullets",9,0
,4,1,"b13-2cols",10,0
,5,1,"bullets",200,4
,11,2,"b13-2cols-with-header-container",0,0
,12,2,"header",200,11
,13,2,"bullets",201,11
,14,2,"b13-2cols-with-header-container",0,0
,15,2,"header",200,14
,16,2,"bullets",201,14
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
,"uid","pid","title"
,1,0,"page-1"
"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-default",256,0,0,0,0,0
,2,1,"header","header-default",128,0,200,1,0,0
,72,1,"b13-2cols-with-header-container","other-container",1256,0,0,0,0,0
,73,1,"bullets","bullets",2128,0,200,72,0,0
,74,1,"bullets","bullets (copy 1)",192,0,201,1,0,0
,"uid","pid","CType","header","sorting","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","container-default",128,0,0
,2,1,"header","header-default",256,200,1
,72,1,"b13-2cols-with-header-container","other-container",1256,0,0
,73,1,"bullets","bullets",2128,200,72
,74,1,"bullets","bullets (copy 1)",756,201,1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"tt_content"
,"uid","pid","CType","header","sorting","colPos","tx_container_parent"
,72,1,"b13-2cols-with-header-container","other-container",1256,0,0
,73,1,"bullets","bullets",2128,200,72
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
,"uid","pid","title"
,1,0,"page-1"
"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-default",256,0,0,0,0,0
,2,1,"header","header-default",128,0,200,1,0,0
,71,1,"header","bullets",1024,0,0,0,0,0
,72,1,"header","bullets (copy 1)",192,0,200,1,0,0
,"uid","pid","CType","header","sorting","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","container-default",128,0,0
,2,1,"header","header-default",256,200,1
,71,1,"header","bullets",1024,0,0
,72,1,"header","bullets (copy 1)",192,200,1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
,"uid","pid","title"
,1,0,"page-1"
"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-default",256,0,0,0,0,0
,2,1,"header","header-default",128,0,200,1,0,0
,71,1,"bullets","bullets",1024,0,0,0,0,0
,"uid","pid","CType","header","sorting","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","container-default",128,0,0
,2,1,"header","header-default",256,200,1
,71,1,"bullets","bullets",1024,0,0
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
,"uid","pid","title"
,1,0,"page-1"
"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-default",256,0,0,0,0,0
,2,1,"header","header-default",128,0,200,1,0,0
,71,1,"bullets","bullets",1024,0,0,0,0,0
,"uid","pid","CType","header","sorting","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","container-default",128,0,0
,2,1,"header","header-default",256,200,1
,71,1,"bullets","bullets",1024,0,0
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
,"uid","pid","title"
,1,0,"page-1"
"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-default",256,0,0,0,0,0
,2,1,"header","header-default",128,0,200,1,0,0
,71,1,"header","bullets",192,0,200,1,0,0
,"uid","pid","CType","header","sorting","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","container-default",128,0,0
,2,1,"header","header-default",256,200,1
,71,1,"header","bullets",640,200,1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
,"uid","pid","title"
,1,0,"page-1"
"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-default",256,0,0,0,0,0
,2,1,"header","header-default",128,0,200,1,0,0
,71,1,"bullets","bullets",1024,0,0,0,0,0
,"uid","pid","CType","header","sorting","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","container-default",128,0,0
,2,1,"header","header-default",256,200,1
,71,1,"bullets","bullets",1024,0,0
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
,"uid","pid","title"
,1,0,"page-1"
"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-default",256,0,0,0,0,0
,2,1,"header","header-default",128,0,200,1,0,0
,71,1,"header","bullets",640,0,200,1,0,0
,"uid","pid","CType","header","sorting","colPos","tx_container_parent",
,1,1,"b13-2cols-with-header-container","container-default",128,0,0,
,2,1,"header","header-default",256,200,1,
,71,1,"header","bullets",192,200,1,

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
,1,0,"page-1","/"
"tt_content"
,"uid","pid","CType","header","sorting","sys_language_uid","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","container-default",256,0,,
,2,1,"header","header-default",128,0,200,1
,1,1,"b13-2cols-with-header-container","container-default",128,0,,
,2,1,"header","header-default",256,0,200,1
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
,2,0,"page-1-language-1"
"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-default",256,0,0,0,0,0
,2,1,"header","header-default",128,0,200,1,0,0
,21,1,"b13-2cols-with-header-container","container-language-1",256,1,0,0,1,0
,22,1,"header","header-language-1",128,1,200,1,2,0
,71,1,"bullets","bullets",1024,0,0,0,0,0
,72,1,"bullets","bullets",1024,1,0,0,71,0
,1,1,"b13-2cols-with-header-container","container-default",128,0,0,0,0,0
,2,1,"header","header-default",256,0,200,1,0,0
,21,1,"b13-2cols-with-header-container","container-language-1",128,1,0,0,1,0
,22,1,"header","header-language-1",256,1,200,1,2,0
,71,1,"bullets","bullets",512,0,0,0,0,0
,72,1,"bullets","bullets",512,1,0,0,71,0
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
,2,0,"page-1-language-1"
"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-default",256,0,0,0,0,0
,2,1,"header","header-default",128,0,200,1,0,0
,21,1,"b13-2cols-with-header-container","container-language-1",256,1,0,0,1,0
,22,1,"header","header-language-1",128,1,200,1,2,0
,71,1,"bullets","bullets",1024,0,0,0,0,0
,72,1,"bullets","bullets",1024,1,0,0,71,0
,1,1,"b13-2cols-with-header-container","container-default",128,0,0,0,0,0
,2,1,"header","header-default",256,0,200,1,0,0
,21,1,"b13-2cols-with-header-container","container-language-1",128,1,0,0,1,0
,22,1,"header","header-language-1",256,1,200,1,2,0
,71,1,"bullets","bullets",512,0,0,0,0,0
,72,1,"bullets","bullets",512,1,0,0,71,0
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
,2,0,"page-1-language-1","/",1,1,1
"tt_content"
,"uid","pid","CType","header","sorting","sys_language_uid","l18n_parent","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","container-default",256,0,,,
,21,1,"b13-2cols-with-header-container","container-language-1",256,1,1,,
,22,1,"header","header-language-1",128,1,2,200,1
,2,1,"header","header-default",128,0,,200,1
,71,1,"bullets","bullets",1024,0,,0,
,72,1,"bullets","bullets",1024,1,71,0,
,1,1,"b13-2cols-with-header-container","container-default",128,0,,,
,21,1,"b13-2cols-with-header-container","container-language-1",128,1,1,,
,22,1,"header","header-language-1",256,1,2,200,1
,2,1,"header","header-default",256,0,,200,1
,71,1,"bullets","bullets",512,0,,0,
,72,1,"bullets","bullets",512,1,71,0,

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
,"uid","pid","title"
,1,0,""
"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","",0,0,0,0,0,0
,2,1,"","",0,0,202,1,0,0
,3,1,"text"," (copy 1)",256,0,201,1,0,0
,"uid","pid","CType","header","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","",0,0
,2,1,"","",202,1
,3,1,"text"," (copy 1)",201,1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
,"uid","pid","title"
,1,0,""
"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","",0,0,0,0,0,0
,2,1,"","",0,0,202,1,0,0
,3,1,"b13-2cols-with-header-container","",0,0,0,0,0,0
,4,1,"text"," (copy 1)",256,0,201,3,0,0
,"uid","pid","CType","colPos","tx_container_parent","l18n_parent","l10n_source"
,1,1,"b13-2cols-with-header-container",0,0,0,0
,2,1,"",202,1,0,0
,3,1,"b13-2cols-with-header-container",0,0,0,0
,4,1,"text",201,3,0,0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"pages"
,"uid","pid"
,1,0
"tt_content"
,"uid","pid","colPos","CType","sorting"
,1,1,0,"b13-2cols-with-header-container",256
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
,"uid","pid","title"
,1,0,""
"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","",512,0,0,0,0,0
,2,1,"text","my-new-header",256,0,202,1,0,0
,"uid","pid","CType","header","sorting","sys_language_uid","colPos","tx_container_parent"
,1,1,"b13-2cols-with-header-container","",256,0,0,0
,2,1,"text","my-new-header",512,0,202,1
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
,1,0
"tt_content"
,"uid","pid","colPos","CType","header","tx_container_parent"
,1,1,0,"b13-2cols-with-header-container",,
,1,1,0,"b13-2cols-with-header-container",,0
,3,1,202,,"foo",1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
,"uid","pid","title"
,1,0,""
"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","",0,0,0,0,0,0
,3,1,"","bar",0,0,202,1,0,0
,"uid","pid","colPos","CType","header","tx_container_parent"
,1,1,0,"b13-2cols-with-header-container",,0
,3,1,202,,"bar",1
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
"tt_content"
,"uid","pid","colPos","CType","tx_container_parent"
,1,1,0,"b13-2cols-with-header-container",
,2,1,202,,1
,2,1,202,,1
,3,1,0,"b13-2cols-with-header-container",
Loading