From a0215194d13ce896bc798c1d23c9edc53af3e616 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Sun, 7 Jul 2024 22:29:25 +0200 Subject: [PATCH] [BUGFIX] Fix plugin preview --- Classes/FormEngine/TtAddressPreviewRenderer.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Classes/FormEngine/TtAddressPreviewRenderer.php b/Classes/FormEngine/TtAddressPreviewRenderer.php index 8d868c77..4dea7f4e 100644 --- a/Classes/FormEngine/TtAddressPreviewRenderer.php +++ b/Classes/FormEngine/TtAddressPreviewRenderer.php @@ -11,9 +11,11 @@ * LICENSE.txt file that was distributed with this source code. */ -use Doctrine\DBAL\Connection; use TYPO3\CMS\Backend\Preview\StandardContentPreviewRenderer; use TYPO3\CMS\Backend\Utility\BackendUtility; +use TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent; +use TYPO3\CMS\Core\Attribute\AsEventListener; +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction; use TYPO3\CMS\Core\Service\FlexFormService; @@ -43,10 +45,15 @@ class TtAddressPreviewRenderer extends StandardContentPreviewRenderer ], ]; - protected function renderContentElementPreviewFromFluidTemplate(array $row): ?string + #[AsEventListener('ext-ttaddress/fluid-preview/content')] + public function __invoke(PageContentPreviewRenderingEvent $event): void { + $row = $event->getRecord(); + if ($row['list_type'] !== 'ttaddress_listview') { + return; + } $row = $this->enrichRow($row); - return parent::renderContentElementPreviewFromFluidTemplate($row); + $event->setRecord($row); } protected function enrichRow(array $row): array