[BUGFIX] Allow TypoScript conditions to access PageArguments 37/60637/2
authorBenni Mack <benni@typo3.org>
Tue, 30 Apr 2019 20:35:59 +0000 (22:35 +0200)
committerBenjamin Franzke <bfr@qbus.de>
Mon, 6 May 2019 05:40:07 +0000 (07:40 +0200)
In order to access resolved route parts by enhancers,
the TypoScript RequestWrapper should allow to access
the PageArguments object.

This way, it is easier to migrate existing conditions like

[globalVar = GP:singlepartner > 0]

to

[request.getPageArguments().get('singlepartner') > 0]

Resolves: #88252
Releases: master, 9.5
Change-Id: I6abed5badac342c88d2b40d38ecf1ea632f321d7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60637
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Guido Schmechel <guido.schmechel@brandung.de>
Tested-by: Benjamin Franzke <bfr@qbus.de>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
typo3/sysext/core/Classes/ExpressionLanguage/RequestWrapper.php

index 9067467..a0fdfa7 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Core\ExpressionLanguage;
 use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Core\Http\NormalizedParams;
 use TYPO3\CMS\Core\Http\ServerRequest;
+use TYPO3\CMS\Core\Routing\RouteResultInterface;
 use TYPO3\CMS\Core\Site\Entity\SiteInterface;
 use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
 
@@ -77,4 +78,9 @@ class RequestWrapper
     {
         return $this->request->getAttribute('normalizedParams');
     }
+
+    public function getPageArguments(): ?RouteResultInterface
+    {
+        return $this->request->getAttribute('routing');
+    }
 }