From 85d004ba1c1c8e4a768304e9cfc5f09f3b49d611 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Thu, 1 Oct 2026 14:38:27 +0200 Subject: [PATCH] [BUGFIX] Provide request for links in info window content Set $GLOBALS['TYPO3_REQUEST'] while rendering the info window content view. f:transform.html resolves links via LinkFactory::createUri() without a ContentObjectRenderer, which falls back to the global request. Within a middleware this global is not set yet, so rendering internal page links failed with a TypeError. The previous value is restored after rendering. This is a temporary workaround until a switch to f:format.html can be evaluated with TYPO3 15. Resolves: #379 Co-Authored-By: Claude Opus 5.5 --- Classes/Service/InfoWindowContentService.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Classes/Service/InfoWindowContentService.php b/Classes/Service/InfoWindowContentService.php index 8f9e205f..d2fb9e39 100644 --- a/Classes/Service/InfoWindowContentService.php +++ b/Classes/Service/InfoWindowContentService.php @@ -80,7 +80,23 @@ private function renderInfoWindowContent(array $poiCollectionRecord, ServerReque $view = $this->createView($maps2TypoScript, $siteSettings, $request); $view->assignMultiple($variables); - return $view->render(); + return $this->renderView($view, $request); + } + + /** + * ToDo: Remove with TYPO3 15. f:transform.html calls LinkFactory::createUri() without cObj, which falls back + * to $GLOBALS['TYPO3_REQUEST']. It is not set within middlewares yet. Check, if f:format.html is an option. + */ + private function renderView(ViewInterface $view, ServerRequestInterface $request): string + { + $previousRequest = $GLOBALS['TYPO3_REQUEST'] ?? null; + $GLOBALS['TYPO3_REQUEST'] = $request; + + try { + return $view->render(); + } finally { + $GLOBALS['TYPO3_REQUEST'] = $previousRequest; + } } private function createView(