Skip to content
Snippets Groups Projects
Commit 8ae6313c authored by Ralf Zimmermann's avatar Ralf Zimmermann Committed by Susanne Moog
Browse files

[BUGFIX] EXT:form - fix templateRootPaths support for email finishers

Fixes "templateRootPaths" support for email finishers.
"templatePathAndFilename" is still functional to avoid breaking changes.

Resolves: #80974
Releases: master, 8.7
Change-Id: Ic8055a925c0608a9166f98b52c34435ac2a56082
Reviewed-on: https://review.typo3.org/53365


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarFrans Saris <franssaris@gmail.com>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarFrans Saris <franssaris@gmail.com>
Reviewed-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Reviewed-by: default avatarTobi Kretschmann <tobi@tobishome.de>
Reviewed-by: default avatarSascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: default avatarSusanne Moog <susanne.moog@typo3.org>
Tested-by: default avatarSusanne Moog <susanne.moog@typo3.org>
parent 72c56183
Branches
Tags
No related merge requests found
...@@ -159,20 +159,30 @@ class EmailFinisher extends AbstractFinisher ...@@ -159,20 +159,30 @@ class EmailFinisher extends AbstractFinisher
*/ */
protected function initializeStandaloneView(FormRuntime $formRuntime): StandaloneView 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')); $format = ucfirst($this->parseOption('format'));
$standaloneView = $this->objectManager->get(StandaloneView::class);
$this->options['templatePathAndFilename'] = strtr($this->options['templatePathAndFilename'], [ if (isset($this->options['templatePathAndFilename'])) {
'{@format}' => $format $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()); $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'])) { if (isset($this->options['partialRootPaths']) && is_array($this->options['partialRootPaths'])) {
$standaloneView->setPartialRootPaths($this->options['partialRootPaths']); $standaloneView->setPartialRootPaths($this->options['partialRootPaths']);
} }
......
...@@ -398,7 +398,9 @@ TYPO3: ...@@ -398,7 +398,9 @@ TYPO3:
#translation: #translation:
# language: 'default' # language: 'default'
# {@format} depends the 'format' value # {@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: [] #partialRootPaths: []
#layoutRootPaths: [] #layoutRootPaths: []
#variables: {} #variables: {}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment