From 67bd9223cf532d72d251f51f8ed971ef8a9024dc Mon Sep 17 00:00:00 2001 From: bwaidelich Date: Thu, 6 Aug 2020 12:28:34 +0200 Subject: [PATCH] FEATURE: Make FormValues directly available in EmailFinisher template Adjusts the `EmailFinisher` so that formValues are available as placeholders directly (i.e. without requiring the `formValues.*` prefix). That allows the `EmailFinisher` to be used the same way as the `ConfirmationFinisher`. Note: This change is backwards compatible since the `formValues.` prefix is still supported. Resolves: #121 --- Classes/Finishers/EmailFinisher.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Classes/Finishers/EmailFinisher.php b/Classes/Finishers/EmailFinisher.php index 5f2436f..05f5e18 100644 --- a/Classes/Finishers/EmailFinisher.php +++ b/Classes/Finishers/EmailFinisher.php @@ -17,6 +17,7 @@ use Neos\Form\Core\Model\AbstractFinisher; use Neos\Form\Exception\FinisherException; use Neos\SwiftMailer\Message as SwiftMailerMessage; +use Neos\Utility\Arrays; use Neos\Utility\ObjectAccess; use Neos\Flow\Annotations as Flow; @@ -248,11 +249,13 @@ protected function initializeStandaloneView(string $format = ''): StandaloneView $standaloneView->setLayoutRootPath($this->options['layoutRootPath']); } - $standaloneView->assign('formValues', $this->finisherContext->getFormValues()); - + $variables = $this->finisherContext->getFormValues(); + // Backwards compatibility, see https://github.com/neos/form/issues/121 + $variables['formValues'] = $this->finisherContext->getFormValues(); if (isset($this->options['variables'])) { - $standaloneView->assignMultiple($this->options['variables']); + $variables = Arrays::arrayMergeRecursiveOverrule($variables, $this->options['variables']); } + $standaloneView->assignMultiple($variables); return $standaloneView; }