Render order should be Twig -> Markdown -> Html

Use unrendered markdown as defaul text template
This commit is contained in:
Samuel Georges 2017-07-15 00:55:56 +10:00
parent dc3e521c36
commit 81b28e3938

View File

@ -63,9 +63,11 @@ class MailManager
/*
* HTML contents
*/
$templateHtml = Markdown::parse($template->content_html);
$templateHtml = $template->content_html;
$html = Twig::parse($templateHtml, $data);
$html = Markdown::parse($html);
if ($template->layout) {
$html = Twig::parse($template->layout->content_html, [
'content' => $html,
@ -78,8 +80,13 @@ class MailManager
/*
* Text contents
*/
if (strlen($template->content_text)) {
$text = Twig::parse($template->content_text, $data);
$templateText = $template->content_text;
if (!strlen($template->content_text)) {
$templateText = $template->content_html;
}
$text = Twig::parse($templateText, $data);
if ($template->layout) {
$text = Twig::parse($template->layout->content_text, [
'content' => $text
@ -88,7 +95,6 @@ class MailManager
$message->addPart($text, 'text/plain');
}
}
//
// Registration