Commit 4747006f authored by Georgi Mateev's avatar Georgi Mateev
Browse files

[TASK] 1584 add placeholder support for sender in the template editor

parent e85049f2
......@@ -379,7 +379,7 @@ class MailController extends ActionController {
foreach ((array) $parameters['templates'] as $key => $template) {
$mailTemplateService->setLanguage($key);
$mailTemplateService->setToAddresses($parameters['emailAddress']);
$mailTemplateService->setFromAddress($template['fromMail']);
// $mailTemplateService->setFromAddress($template['fromMail']);
$mailTemplateService->setTemplateName($parameters['selectedTemplate']);
$mailTemplateService->setExtensionKey($parameters['selectedExtension']);
$mailTemplateService->setPreviewMarkers();
......
......@@ -709,7 +709,6 @@ class MailTemplateService {
}
if ($isPreview) {
$this->setIgnoreMailQueue(TRUE);
}
......@@ -724,12 +723,21 @@ class MailTemplateService {
$overwrittenSubject = $this->subject;
}
// parse markers
if ($template !== NULL) {
$emailView->setTemplateSource(
\trim(empty($overwrittenSubject) ? $template->getSubject() : $overwrittenSubject)
);
$subject = $emailView->render();
$emailView->setTemplateSource(
$this->getTemplateSource(
$template->getFromMail(),
$template->getLayout(), $siteRootId
)
);
$fromMail = $emailView->render();
$emailView->setTemplateSource(
$this->getTemplateSource(
empty($overwrittenEmailBody) ? $template->getContent() : $overwrittenEmailBody,
......@@ -748,6 +756,14 @@ class MailTemplateService {
$emailView->setTemplateSource(empty($overwrittenSubject) ? $subject : $overwrittenSubject);
$subject = $emailView->render();
$emailView->setTemplateSource(
$this->getTemplateSource(
$template->getFromMail(),
0, $siteRootId
)
);
$fromMail = $emailView->render();
$emailView->setTemplateSource(
$this->getTemplateSource(
empty($overwrittenEmailBody) ? $defaultTemplateContent : $overwrittenEmailBody,
......@@ -757,6 +773,7 @@ class MailTemplateService {
}
$this->mailMessage->setSubject($subject);
$this->setFromAddress($fromMail);
// insert <br> tags, but replace every instance of three or more successive breaks with just two.
$emailBody = $emailView->render();
......
......@@ -164,7 +164,7 @@
</div>
<div class="row form-group">
<label for="parameters[templates][{key}][fromMail]" class="">{f:translate(key:'backend.fromMail')}</label>
<f:form.textfield type="email" class="form-control" value="{languageTemplate.fromMail}" name="parameters[templates][{key}][fromMail]" />
<f:form.textfield type="text" class="form-control" value="{languageTemplate.fromMail}" name="parameters[templates][{key}][fromMail]" />
</div>
<div class="row form-group">
<label for="parameters[templates][{key}][toAddress]" class="">{f:translate(key:'backend.to_form')}</label>
......
Supports Markdown
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