Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward request to Fluid preview renderer #126

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Classes/Indexer/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion Classes/Preview/FluidPreviewRenderer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace PAGEmachine\Searchable\Preview;

use PAGEmachine\Searchable\Preview\RequestAwarePreviewRendererInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
Expand All @@ -13,7 +15,7 @@
/**
* Fluid Preview Renderer. Uses a Fluid Standalone View to render previews
*/
class FluidPreviewRenderer extends AbstractPreviewRenderer implements PreviewRendererInterface
class FluidPreviewRenderer extends AbstractPreviewRenderer implements PreviewRendererInterface, RequestAwarePreviewRendererInterface
{
/**
* @var StandaloneView $view
Expand All @@ -34,6 +36,10 @@ public function __construct(...$arguments)

$this->prepareView();
}
public function setRequest(ServerRequestInterface $request): void
{
$this->view->setRequest($request);
}

/**
* Renders the preview
Expand Down
13 changes: 13 additions & 0 deletions Classes/Preview/RequestAwarePreviewRendererInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
namespace PAGEmachine\Searchable\Preview;

/*
* This file is part of the PAGEmachine Searchable project.
*/

use Psr\Http\Message\ServerRequestInterface;

interface RequestAwarePreviewRendererInterface
{
public function setRequest(ServerRequestInterface $request): void;
}
Loading