diff --git a/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php b/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php index cd6958eb21d9215d440d6c193940bd52005c0670..4bc3be30d9e43917f639551a47803617132f0b38 100644 --- a/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php +++ b/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php @@ -159,20 +159,30 @@ class EmailFinisher extends AbstractFinisher */ protected function initializeStandaloneView(FormRuntime $formRuntime): StandaloneView { - if (!isset($this->options['templatePathAndFilename'])) { - throw new FinisherException('The option "templatePathAndFilename" must be set for the EmailFinisher.', 1327058829); - } - $format = ucfirst($this->parseOption('format')); + $standaloneView = $this->objectManager->get(StandaloneView::class); - $this->options['templatePathAndFilename'] = strtr($this->options['templatePathAndFilename'], [ - '{@format}' => $format - ]); + if (isset($this->options['templatePathAndFilename'])) { + $this->options['templatePathAndFilename'] = strtr($this->options['templatePathAndFilename'], [ + '{@format}' => $format + ]); + $standaloneView->setTemplatePathAndFilename($this->options['templatePathAndFilename']); + } else { + 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'], [ + '{@format}' => $format + ]); + $standaloneView->setTemplate($this->options['templateName']); + } - $standaloneView = $this->objectManager->get(StandaloneView::class); - $standaloneView->setTemplatePathAndFilename($this->options['templatePathAndFilename']); $standaloneView->assign('finisherVariableProvider', $this->finisherContext->getFinisherVariableProvider()); + if (isset($this->options['templateRootPaths']) && is_array($this->options['templateRootPaths'])) { + $standaloneView->setTemplateRootPaths($this->options['templateRootPaths']); + } + if (isset($this->options['partialRootPaths']) && is_array($this->options['partialRootPaths'])) { $standaloneView->setPartialRootPaths($this->options['partialRootPaths']); } diff --git a/typo3/sysext/form/Configuration/Yaml/BaseSetup.yaml b/typo3/sysext/form/Configuration/Yaml/BaseSetup.yaml index f0deb59eaa8fc9f7828fb28858dc06eeb69dcb2c..821125314f374a457cb2b1db86465d540cc5a83f 100644 --- a/typo3/sysext/form/Configuration/Yaml/BaseSetup.yaml +++ b/typo3/sysext/form/Configuration/Yaml/BaseSetup.yaml @@ -398,7 +398,9 @@ TYPO3: #translation: # language: 'default' # {@format} depends the 'format' value - templatePathAndFilename: 'EXT:form/Resources/Private/Frontend/Templates/Finishers/Email/{@format}.html' + templateName: '{@format}.html' + templateRootPaths: + 10: 'EXT:form/Resources/Private/Frontend/Templates/Finishers/Email/' #partialRootPaths: [] #layoutRootPaths: [] #variables: {}