From b27c418783fce6415db61f9dacb6b15847b05b14 Mon Sep 17 00:00:00 2001 From: Niklas Droste Date: Wed, 10 Feb 2021 15:26:39 +0100 Subject: [PATCH] Bugfix: Use siteNode while rendering in API --- Classes/Controller/ApiController.php | 10 +++++++--- Resources/Private/Fusion/Root.fusion | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Classes/Controller/ApiController.php b/Classes/Controller/ApiController.php index 733d277..63f4b26 100644 --- a/Classes/Controller/ApiController.php +++ b/Classes/Controller/ApiController.php @@ -46,12 +46,16 @@ public function initializeAction() $this->response->setComponentParameter(SetHeaderComponent::class, 'Vary', 'Origin'); } - - public function renderCookieSettingsAction(array $dimensions = []) + /** + * @param NodeInterface $siteNode + * @throws \Neos\ContentRepository\Exception\NodeException + * @throws \Neos\Eel\Exception + */ + public function renderCookieSettingsAction(NodeInterface $siteNode) { $this->view->setVariablesToRender(['html', 'needsRenew']); - $q = new FlowQuery([$this->contextFactory->create(['dimensions' => $dimensions])->getRootNode()]); + $q = new FlowQuery([$siteNode]); $node = $q->find('[instanceof KaufmannDigital.GDPR.CookieConsent:Content.CookieSettings]')->get(0); //Reply with empty string, if there is no configured CookieConsent diff --git a/Resources/Private/Fusion/Root.fusion b/Resources/Private/Fusion/Root.fusion index b84dc60..a4b1d13 100644 --- a/Resources/Private/Fusion/Root.fusion +++ b/Resources/Private/Fusion/Root.fusion @@ -9,7 +9,7 @@ prototype(Neos.Neos:Page) { package = 'KaufmannDigital.GDPR.CookieConsent' controller = 'Api' action = 'renderCookieSettings' - arguments.dimensions = ${site.context.dimensions} + arguments.siteNode = ${site.contextPath} absolute = true }