Skip to content
Snippets Groups Projects

[BUGFIX] replace newlines in mail layout too

Merged Kevin von Spiczak requested to merge bugfix_347-NewLinesInMailLayouts into master
1 file
+ 4
3
Compare changes
  • Side-by-side
  • Inline
@@ -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>';
}
Loading