Skip to content

Commit

Permalink
fix: use fqcn for data processors, do not use dependency injection
Browse files Browse the repository at this point in the history
  • Loading branch information
maikschneider committed Mar 13, 2024
1 parent 3281304 commit c379858
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions Classes/DataProcessing/AbstractProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -13,23 +14,24 @@ 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,
array $contentObjectConfiguration,
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;
Expand Down
6 changes: 3 additions & 3 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit c379858

Please sign in to comment.