From c3798583d1399dd8244af1ab060709e9d2711ab9 Mon Sep 17 00:00:00 2001 From: Maik Schneider Date: Wed, 13 Mar 2024 12:03:51 +0100 Subject: [PATCH] fix: use fqcn for data processors, do not use dependency injection --- Classes/DataProcessing/AbstractProcessor.php | 14 ++++++++------ Configuration/TypoScript/setup.typoscript | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Classes/DataProcessing/AbstractProcessor.php b/Classes/DataProcessing/AbstractProcessor.php index 1273c43..2d2d3a6 100644 --- a/Classes/DataProcessing/AbstractProcessor.php +++ b/Classes/DataProcessing/AbstractProcessor.php @@ -3,6 +3,7 @@ namespace Xima\XmFormcycle\DataProcessing; use TYPO3\CMS\Core\Service\FlexFormService; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface; use Xima\XmFormcycle\Dto\ElementSettings; @@ -13,11 +14,7 @@ abstract class AbstractProcessor implements DataProcessorInterface { protected ElementSettings $settings; - public function __construct( - protected readonly FormcycleService $formcycleService, - private readonly FlexFormService $flexFormService - ) { - } + protected FormcycleService $formcycleService; public function process( ContentObjectRenderer $cObj, @@ -25,11 +22,16 @@ public function process( array $processorConfiguration, array $processedData ) { + // construct element settings + $flexFormService = GeneralUtility::makeInstance(FlexFormService::class); $this->settings = ElementSettings::createFromContentElement( - $this->flexFormService, + $flexFormService, $cObj, ); + $this->formcycleService = GeneralUtility::makeInstance(FormcycleService::class); + + // check if concrete processor should be used $currentIntegrationMode = $this->settings->integrationMode ?? $this->formcycleService->getDefaultIntegrationMode(); if ($currentIntegrationMode->forDataProcessing() !== $this->getIntegrationMode()) { return $processedData; diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 4d6b931..04bfe71 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -10,9 +10,9 @@ tt_content.formcycle { templateName = Formcycle dataProcessing { - 1709129505 = formcycle-ajax - 1709129509 = formcycle-iframe - 1709129512 = formcycle-integrated + 1709129505 = Xima\XmFormcycle\DataProcessing\AjaxProcessor + 1709129509 = Xima\XmFormcycle\DataProcessing\iFrameProcessor + 1709129512 = Xima\XmFormcycle\DataProcessing\IntegratedProcessor } }