diff --git a/Classes/Indexer/Indexer.php b/Classes/Indexer/Indexer.php index 664b1ea..258b6d5 100644 --- a/Classes/Indexer/Indexer.php +++ b/Classes/Indexer/Indexer.php @@ -6,6 +6,7 @@ use PAGEmachine\Searchable\LinkBuilder\PageLinkBuilder; use PAGEmachine\Searchable\Preview\DefaultPreviewRenderer; use PAGEmachine\Searchable\Preview\PreviewRendererInterface; +use PAGEmachine\Searchable\Preview\RequestAwarePreviewRendererInterface; use PAGEmachine\Searchable\Query\BulkQuery; use PAGEmachine\Searchable\Query\UpdateQuery; use PAGEmachine\Searchable\Service\ExtconfService; @@ -244,6 +245,10 @@ public function run() { TsfeUtility::createTSFE($this->config['siteIdentifier'] ?? null, $this->language); + if (is_a($this->previewRenderer, RequestAwarePreviewRendererInterface::class)) { + $this->previewRenderer->setRequest($GLOBALS['TYPO3_REQUEST']); + } + $bulkSize = ($this->config['bulkSize'] ?? null) ?: 20; $counter = 0; @@ -287,6 +292,10 @@ public function runUpdate() { TsfeUtility::createTSFE($this->config['siteIdentifier'] ?? null, $this->language); + if (is_a($this->previewRenderer, RequestAwarePreviewRendererInterface::class)) { + $this->previewRenderer->setRequest($GLOBALS['TYPO3_REQUEST']); + } + $bulkSize = ($this->config['bulkSize'] ?? null) ?: 20; $counter = 0; diff --git a/Classes/Preview/FluidPreviewRenderer.php b/Classes/Preview/FluidPreviewRenderer.php index 17aea0f..16a86b2 100644 --- a/Classes/Preview/FluidPreviewRenderer.php +++ b/Classes/Preview/FluidPreviewRenderer.php @@ -1,10 +1,12 @@ prepareView(); } + public function setRequest(ServerRequestInterface $request): void + { + $this->view->setRequest($request); + } /** * Renders the preview diff --git a/Classes/Preview/RequestAwarePreviewRendererInterface.php b/Classes/Preview/RequestAwarePreviewRendererInterface.php new file mode 100644 index 0000000..90785fc --- /dev/null +++ b/Classes/Preview/RequestAwarePreviewRendererInterface.php @@ -0,0 +1,13 @@ +getMajorVersion() < 12) { $frontendController->getConfigArray($request); + } else { + $GLOBALS['TYPO3_REQUEST'] = $frontendController->getFromCache($GLOBALS['TYPO3_REQUEST']); } $GLOBALS['TSFE'] = $frontendController;