diff --git a/src/Contao/Event/Subscriber.php b/src/Contao/Event/Subscriber.php index 8389ac93..c656a5dd 100644 --- a/src/Contao/Event/Subscriber.php +++ b/src/Contao/Event/Subscriber.php @@ -327,7 +327,7 @@ public function initializePanels(ActionEvent $event): void if ( !\in_array( $event->getAction()->getName(), - ['copy', 'create', 'paste', 'delete', 'move', 'undo', 'edit', 'toggle', 'showAll', 'show'], + ['copy', 'deepcopy', 'create', 'paste', 'delete', 'move', 'undo', 'edit', 'toggle', 'showAll', 'show'], true ) ) { diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/CopyHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/CopyHandler.php index 266304f4..4876824e 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/CopyHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/CopyHandler.php @@ -127,7 +127,7 @@ public function handleEvent(ActionEvent $event) return; } - if ('copy' !== $event->getAction()->getName()) { + if (!\in_array($event->getAction()->getName(), ['copy', 'deepcopy'])) { return; } diff --git a/src/Contao/View/Contao2BackendView/ActionHandler/SelectHandler.php b/src/Contao/View/Contao2BackendView/ActionHandler/SelectHandler.php index 6db5632e..04309d29 100644 --- a/src/Contao/View/Contao2BackendView/ActionHandler/SelectHandler.php +++ b/src/Contao/View/Contao2BackendView/ActionHandler/SelectHandler.php @@ -395,7 +395,7 @@ private function handleCopyAllAction(EnvironmentInterface $environment, Action $ $inputProvider->unsetParameter('source'); } - ViewHelpers::redirectHome($environment); + ViewHelpers::redirectCleanHome($environment, ['select']); } /** diff --git a/src/Contao/View/Contao2BackendView/ButtonRenderer.php b/src/Contao/View/Contao2BackendView/ButtonRenderer.php index 61f3f8aa..146019ba 100644 --- a/src/Contao/View/Contao2BackendView/ButtonRenderer.php +++ b/src/Contao/View/Contao2BackendView/ButtonRenderer.php @@ -460,6 +460,7 @@ private function getChildIds(ModelInterface $model): array private function calculateParameters(CommandInterface $command, string $serializedModelId): array { $parameters = (array) $command->getParameters(); + if ($command instanceof ToggleCommandInterface) { // Toggle has to trigger the javascript. $parameters['act'] = $command->getName(); @@ -467,6 +468,7 @@ private function calculateParameters(CommandInterface $command, string $serializ return $parameters; } + if (($command instanceof CutCommandInterface) || ($command instanceof CopyCommandInterface)) { // Cut & copy need some special information. if (!\array_key_exists('act', $parameters)) { diff --git a/src/Contao/View/Contao2BackendView/Controller/ClipboardController.php b/src/Contao/View/Contao2BackendView/Controller/ClipboardController.php index 6ea014fd..106e2aea 100644 --- a/src/Contao/View/Contao2BackendView/Controller/ClipboardController.php +++ b/src/Contao/View/Contao2BackendView/Controller/ClipboardController.php @@ -301,7 +301,10 @@ private function addToClipboard(ActionEvent $event) $this->removeItemsFromClipboard($event); // Only push item to clipboard if manual sorting is used. - if (Item::COPY === $clipboardActionName && null === ViewHelpers::getManualSortingProperty($environment)) { + if ( + \in_array($clipboardActionName, [Item::COPY, Item::DEEP_COPY]) + && null === ViewHelpers::getManualSortingProperty($environment) + ) { return; } @@ -309,7 +312,7 @@ private function addToClipboard(ActionEvent $event) $item = new Item($clipboardActionName, $parentId, $modelId); } - // If edit several don´t redirect do home and push item to the clipboard. + // If edit several don´t redirect to home and push item to the clipboard. if ('select' === $input->getParameter('act')) { $clipboard->push($item)->saveTo($environment); @@ -319,7 +322,7 @@ private function addToClipboard(ActionEvent $event) // Let the clipboard save it's values persistent. $clipboard->clear()->push($item)->saveTo($environment); - ViewHelpers::redirectHome($environment); + ViewHelpers::redirectCleanHome($environment, ['select']); } /** diff --git a/src/Contao/View/Contao2BackendView/ViewHelpers.php b/src/Contao/View/Contao2BackendView/ViewHelpers.php index fba7c081..cf2e7a30 100644 --- a/src/Contao/View/Contao2BackendView/ViewHelpers.php +++ b/src/Contao/View/Contao2BackendView/ViewHelpers.php @@ -113,6 +113,7 @@ public static function getManualSortingProperty(EnvironmentInterface $environmen $sort = $panel->getElement('sort'); if ($sort instanceof SortElementInterface) { $definition = $sort->getSelectedDefinition(); + break; } }