Skip to content

Commit

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

Fix copy item in tree view - before we have a "move" instead of copy
  • Loading branch information
stefanheimes committed Sep 15, 2024
2 parents 5f6e745 + f0d67cb commit d3a2b2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Contao/View/Contao2BackendView/ButtonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
use ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException;
use ContaoCommunityAlliance\DcGeneral\InputProviderInterface;
use ContaoCommunityAlliance\Translator\TranslatorInterface;
use ContaoCommunityAlliance\UrlBuilder\UrlBuilder;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

use function array_filter;
Expand Down Expand Up @@ -232,7 +233,8 @@ private function renderButtonsFor(
if ($this->hasPasteButtons()) {
$urlAfter = $this->addToUrl(sprintf('act=paste&after=%s&', $modelId));
$urlInto = $this->addToUrl(sprintf('act=paste&into=%s&', $modelId));

$urlAfter = UrlBuilder::fromUrl($urlAfter)->unsetQueryParameter('source')->getUrl();
$urlInto = UrlBuilder::fromUrl($urlInto)->unsetQueryParameter('source')->getUrl();

$buttonEvent = new GetPasteButtonEvent($this->environment);
$buttonEvent
Expand Down
5 changes: 4 additions & 1 deletion src/Contao/View/Contao2BackendView/TreeView.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
use ContaoCommunityAlliance\DcGeneral\Panel\SortElementInterface;
use ContaoCommunityAlliance\DcGeneral\SessionStorageInterface;
use ContaoCommunityAlliance\Translator\TranslatorInterface;
use ContaoCommunityAlliance\UrlBuilder\UrlBuilder;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
Expand Down Expand Up @@ -606,9 +607,11 @@ protected function viewTree($collection)
ContaoEvents::BACKEND_ADD_TO_URL
);

$urlInto = UrlBuilder::fromUrl($urlEvent->getUrl())->unsetQueryParameter('source')->getUrl();

$buttonEvent = new GetPasteRootButtonEvent($environment);
$buttonEvent
->setHref($urlEvent->getUrl())
->setHref($urlInto)
->setPasteDisabled(false);

$dispatcher->dispatch($buttonEvent, $buttonEvent::NAME);
Expand Down

0 comments on commit d3a2b2a

Please sign in to comment.