Skip to content

Commit

Permalink
[TASK] Do not provide FormDataGroup in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
sypets committed Oct 27, 2024
1 parent 418e211 commit 8bba2f4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Classes/Parser/LinkParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Sypets\Brofix\Util\TcaUtil;
use TYPO3\CMS\Backend\Form\Exception\DatabaseDefaultLanguageException;
use TYPO3\CMS\Backend\Form\FormDataCompiler;
use TYPO3\CMS\Backend\Form\FormDataGroupInterface;
use TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserFactory;
use TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserInterface;
use TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult;
Expand Down Expand Up @@ -50,6 +51,7 @@ class LinkParser

protected ?ServerRequestInterface $request;
protected ?FormDataCompiler $formDataCompiler;
protected ?FormDataGroupInterface $formDataGroup;
protected Configuration $configuration;
protected SoftReferenceParserFactory $softReferenceParserFactory;
protected ContentRepository $contentRepository;
Expand Down Expand Up @@ -102,10 +104,10 @@ protected function setConfiguration(Configuration $configuration): void
$this->configuration = $configuration;

/** @phpstan-ignore-next-line */
$formDataGroup = GeneralUtility::makeInstance($this->configuration->getFormDataGroup());
$this->formDataGroup = GeneralUtility::makeInstance($this->configuration->getFormDataGroup());
/** @phpstan-ignore-next-line */
if ($formDataGroup) {
$this->formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup);
if ($this->formDataGroup) {
$this->formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class);
}
}

Expand Down Expand Up @@ -463,7 +465,7 @@ public function isRecordShouldBeChecked(string $tablename, array $row): bool
*/
public function getProcessedFormData(int $uid, string $tablename, ServerRequestInterface $request): array
{
if (!$this->formDataCompiler) {
if (!$this->formDataCompiler || !$this->formDataGroup) {
return [];
}

Expand All @@ -485,7 +487,7 @@ public function getProcessedFormData(int $uid, string $tablename, ServerRequestI
'request' => $request,
];

$this->processedFormData = $this->formDataCompiler->compile($formDataCompilerInput);
$this->processedFormData = $this->formDataCompiler->compile($formDataCompilerInput, $this->formDataGroup);

// undo hack
if ($isAdmin === false) {
Expand Down

0 comments on commit 8bba2f4

Please sign in to comment.