Skip to content

Commit

Permalink
Merge tag '2.3.28'
Browse files Browse the repository at this point in the history
Hotfix release 2.3.28

- Fix deepcopy issues
- Fix move item if clipboard not empty
  • Loading branch information
stefanheimes committed Jan 12, 2025
2 parents 00a0cbf + 019c9d0 commit 8edfeba
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Contao/Event/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function handleEvent(ActionEvent $event)
return;
}

if ('copy' !== $event->getAction()->getName()) {
if (!\in_array($event->getAction()->getName(), ['copy', 'deepcopy'])) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ protected function process(EnvironmentInterface $environment)
assert(\is_string($providerName));

// Check if it is a simple create-paste of a single model, if so, redirect to edit view.
// Only for not ajax calls e.g. move.
if (
$this->isSimpleCreatePaste(
null === $input->getParameter('isAjax')
&& $this->isSimpleCreatePaste(
$clipboard,
$providerName
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private function handleCopyAllAction(EnvironmentInterface $environment, Action $
$inputProvider->unsetParameter('source');
}

ViewHelpers::redirectHome($environment);
ViewHelpers::redirectCleanHome($environment, ['select']);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Contao/View/Contao2BackendView/ButtonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,15 @@ 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();
$parameters['id'] = $serializedModelId;

return $parameters;
}

if (($command instanceof CutCommandInterface) || ($command instanceof CopyCommandInterface)) {
// Cut & copy need some special information.
if (!\array_key_exists('act', $parameters)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,18 @@ 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;
}

// create the new item
$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);

Expand All @@ -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']);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Contao/View/Contao2BackendView/ViewHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public static function getManualSortingProperty(EnvironmentInterface $environmen
$sort = $panel->getElement('sort');
if ($sort instanceof SortElementInterface) {
$definition = $sort->getSelectedDefinition();
break;
}
}

Expand Down

0 comments on commit 8edfeba

Please sign in to comment.