mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge 80112d79a7
into 81cba4ed4c
This commit is contained in:
commit
410adfc541
@ -31,8 +31,9 @@ use SilverStripe\UserForms\Model\UserDefinedForm;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\Model\ArrayData;
|
||||
use SilverStripe\View\Requirements;
|
||||
use SilverStripe\View\SSViewer;
|
||||
use SilverStripe\Model\ModelData;
|
||||
use SilverStripe\View\TemplateEngine;
|
||||
use SilverStripe\View\ViewLayerData;
|
||||
use Swift_RfcComplianceException;
|
||||
|
||||
/**
|
||||
@ -421,7 +422,8 @@ JS
|
||||
// Include any parsed merge field references from the CMS editor - this is already escaped
|
||||
// This string substitution works for both HTML and plain text emails.
|
||||
// $recipient->getEmailBodyContent() will retrieve the relevant version of the email
|
||||
$emailData['Body'] = SSViewer::execute_string($recipient->getEmailBodyContent(), $mergeFields);
|
||||
$engine = Injector::inst()->create(TemplateEngine::class);
|
||||
$emailData['Body'] = $engine->renderString($recipient->getEmailBodyContent(), ViewLayerData::create($mergeFields));
|
||||
// only include visible fields if recipient visibility flag is set
|
||||
if ((bool) $recipient->HideInvisibleFields) {
|
||||
$emailData['Fields'] = $visibleSubmittedFields;
|
||||
@ -487,10 +489,10 @@ JS
|
||||
if ($submittedFormField && trim($submittedFormField->Value ?? '')) {
|
||||
$email->setSubject($submittedFormField->Value);
|
||||
} else {
|
||||
$email->setSubject(SSViewer::execute_string($recipient->EmailSubject, $mergeFields));
|
||||
$email->setSubject($engine->renderString($recipient->EmailSubject, ViewLayerData::create($mergeFields)));
|
||||
}
|
||||
} else {
|
||||
$email->setSubject(SSViewer::execute_string($recipient->EmailSubject, $mergeFields));
|
||||
$email->setSubject($engine->renderString($recipient->EmailSubject, ViewLayerData::create($mergeFields)));
|
||||
}
|
||||
|
||||
$this->extend('updateEmail', $email, $recipient, $emailData);
|
||||
|
Loading…
Reference in New Issue
Block a user