-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/fix_add_all_button_ref' into 'release/2.3.0'
Fix add all button ref See merge request metamodels/core!340
- Loading branch information
Showing
2 changed files
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/** | ||
* This file is part of MetaModels/core. | ||
* | ||
* (c) 2012-2023 The MetaModels team. | ||
* (c) 2012-2024 The MetaModels team. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
@@ -14,7 +14,7 @@ | |
* @author Christian Schiffler <[email protected]> | ||
* @author Sven Baumann <[email protected]> | ||
* @author Ingolf Steinhardt <[email protected]> | ||
* @copyright 2012-2023 The MetaModels team. | ||
* @copyright 2012-2024 The MetaModels team. | ||
* @license https://github.com/MetaModels/core/blob/master/LICENSE LGPL-3.0-or-later | ||
* @filesource | ||
*/ | ||
|
@@ -27,6 +27,7 @@ | |
use ContaoCommunityAlliance\DcGeneral\InputProviderInterface; | ||
use Doctrine\DBAL\Connection; | ||
use MetaModels\IFactory; | ||
use Symfony\Component\HttpFoundation\RequestStack; | ||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | ||
|
||
/** | ||
|
@@ -55,18 +56,31 @@ class AddAllButtonListener | |
*/ | ||
private UrlGeneratorInterface $urlGenerator; | ||
|
||
/** | ||
* The request stack. | ||
* | ||
* @var RequestStack | ||
*/ | ||
private RequestStack $requestStack; | ||
|
||
/** | ||
* Create a new instance. | ||
* | ||
* @param Connection $connection The connection. | ||
* @param IFactory $factory The factory. | ||
* @param UrlGeneratorInterface $urlGenerator The url generator. | ||
* @param RequestStack $requestStack The session. | ||
*/ | ||
public function __construct(Connection $connection, IFactory $factory, UrlGeneratorInterface $urlGenerator) | ||
{ | ||
$this->connection = $connection; | ||
$this->factory = $factory; | ||
public function __construct( | ||
Connection $connection, | ||
IFactory $factory, | ||
UrlGeneratorInterface $urlGenerator, | ||
RequestStack $requestStack | ||
) { | ||
$this->connection = $connection; | ||
$this->factory = $factory; | ||
$this->urlGenerator = $urlGenerator; | ||
$this->requestStack = $requestStack; | ||
} | ||
|
||
/** | ||
|
@@ -108,13 +122,15 @@ public function getGlobalButton(GetGlobalButtonEvent $event) | |
return; | ||
} | ||
|
||
$name = $this->factory->translateIdToMetaModelName($modelId); | ||
$name = $this->factory->translateIdToMetaModelName($modelId); | ||
$request = $this->requestStack->getCurrentRequest(); | ||
|
||
$event->setHref( | ||
$this->urlGenerator->generate( | ||
'metamodels.rendersetting.add_all', | ||
['metaModel' => $name, 'renderSetting' => $renderSetting] | ||
) | ||
. '?ref=' . $request?->attributes->get('_contao_referer_id') | ||
); | ||
} | ||
} |