Commit 5b9ee9f1 authored by Kevin von Spiczak's avatar Kevin von Spiczak
Browse files

Merge branch 'bugfix_347-NewLinesInMailLayouts' into 'master'

[BUGFIX] replace newlines in mail layout too

See merge request !28
parents bb6c3845 3614c95a
......@@ -944,10 +944,7 @@ class MailTemplateService {
empty($overwrittenEmailBody) ? $templateContent : $overwrittenEmailBody
);
// insert <br> tags, but replace every instance of three or more successive breaks with just two.
$emailBody = $emailView->render();
$emailBody = \nl2br($emailBody);
$emailBody = \preg_replace('/(<br[\s]?[\/]?>[\s]*){3,}/', '<br><br>', $emailBody);
$layout = $this->getLayoutSource($layoutId, $siteRootId);
$emailHTMLHead = '';
......@@ -955,6 +952,10 @@ class MailTemplateService {
$emailHTMLHead = $layout->getHeadContent();
$emailBody = \str_replace('###CONTENT###', $emailBody, $layout->getContent());
}
// insert <br> tags, but replace every instance of three or more successive breaks with just two.
$emailBody = \nl2br($emailBody);
$emailBody = \preg_replace('/(<br[\s]?[\/]?>[\s]*){3,}/', '<br><br>', $emailBody);
$this->mailBodyToSend = '<html><head>' . $emailHTMLHead . '</head><body>' . $emailBody . '</body></html>';
}
......
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