From b6a3e626156a675b4aed85ae365215a8d9563aa5 Mon Sep 17 00:00:00 2001 From: Markus Weigelt Date: Wed, 23 Oct 2024 16:01:04 +0200 Subject: [PATCH] Get page id by rooting request attribute --- Classes/Controller/SruController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Classes/Controller/SruController.php b/Classes/Controller/SruController.php index adfb558c..971db1db 100644 --- a/Classes/Controller/SruController.php +++ b/Classes/Controller/SruController.php @@ -22,7 +22,7 @@ class SruController extends AbstractController { /** * The main method of the controller - * + * @xglobal $GLOBALS * @return ResponseInterface */ public function mainAction(): ResponseInterface @@ -54,8 +54,10 @@ public function mainAction(): ResponseInterface return $this->htmlResponse(); } + $pageArguments = $this->request->getAttribute('routing'); + $actionUrl = $this->uriBuilder->reset() - ->setTargetPageUid($GLOBALS['TSFE']->id) + ->setTargetPageUid($pageArguments->getPageId()) ->setCreateAbsoluteUri(true) ->build();