diff --git a/Classes/Domain/Finishers/MjmlEmailFinisher.php b/Classes/Domain/Finishers/MjmlEmailFinisher.php index a2321f9..aac53e7 100644 --- a/Classes/Domain/Finishers/MjmlEmailFinisher.php +++ b/Classes/Domain/Finishers/MjmlEmailFinisher.php @@ -11,12 +11,12 @@ class MjmlEmailFinisher extends \TYPO3\CMS\Form\Domain\Finishers\EmailFinisher { /** * @param FormRuntime $formRuntime + * @param string $format * @return StandaloneView * @throws FinisherException */ - protected function initializeStandaloneView(FormRuntime $formRuntime): StandaloneView + protected function initializeStandaloneView(FormRuntime $formRuntime, string $format): StandaloneView { - $format = ucfirst($this->parseOption('format')); $standaloneView = $this->objectManager->get(MjmlBasedView::class); if (isset($this->options['templatePathAndFilename'])) { @@ -28,10 +28,12 @@ class MjmlEmailFinisher extends \TYPO3\CMS\Form\Domain\Finishers\EmailFinisher if (!isset($this->options['templateName'])) { throw new FinisherException('The option "templateName" must be set for the EmailFinisher.', 1327058829); } - $this->options['templateName'] = strtr($this->options['templateName'], [ + // Use local variable instead of augmenting the options to + // keep the format intact when sending multi-format mails + $templateName = strtr($this->options['templateName'], [ '{@format}' => $format ]); - $standaloneView->setTemplate($this->options['templateName']); + $standaloneView->setTemplate($templateName); } $standaloneView->assign('finisherVariableProvider', $this->finisherContext->getFinisherVariableProvider()); diff --git a/Classes/View/MjmlBasedView.php b/Classes/View/MjmlBasedView.php index c8b2d45..66e3840 100644 --- a/Classes/View/MjmlBasedView.php +++ b/Classes/View/MjmlBasedView.php @@ -7,7 +7,7 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; class MjmlBasedView extends StandaloneView { - protected RendererInterface $renderer; + protected ?RendererInterface $renderer = null; public function __construct(ContentObjectRenderer $contentObject = null, RendererInterface $renderer = null) {