diff --git a/Classes/Service/ConditionService.php b/Classes/Service/ConditionService.php index 406e6fe..0da776a 100644 --- a/Classes/Service/ConditionService.php +++ b/Classes/Service/ConditionService.php @@ -43,6 +43,14 @@ public function getArguments(array $powermailArguments = []): array /** @var Form $form */ $form = $this->formRepository->findByIdentifier($powermailArguments['mail']['form']); + // Use the forms non-localized UID, because the field is l10n_mode exclude + $conditionContainer = $this->conditionContainerRepository->findOneByForm($form->getUid()); + + // Return early if there are no conditions for this form + if ($conditionContainer === null) { + return []; + } + /** @var array $fields */ $fields = []; @@ -67,14 +75,9 @@ public function getArguments(array $powermailArguments = []): array $fields[$fieldName]->setText($fieldValue); } - $arguments = []; - // Use the forms non-localized UID, because the field is l10n_mode exclude - $conditionContainer = $this->conditionContainerRepository->findOneByForm($form->getUid()); - if ($conditionContainer !== null) { - $arguments = $conditionContainer->applyConditions($form, $powermailArguments); - $this->typoscriptFrontendController->fe_user->setAndSaveSessionData('tx_powermail_cond', $arguments); - unset($arguments['backup'], $arguments['field']); - } + $arguments = $conditionContainer->applyConditions($form, $powermailArguments); + $this->typoscriptFrontendController->fe_user->setAndSaveSessionData('tx_powermail_cond', $arguments); + unset($arguments['backup'], $arguments['field']); return $arguments; }