/** * Compile email message * * @param EmailTemplateInterface $template * @param array $templateParams * * @return array first element is email subject, second - message */ public function compileMessage(EmailTemplateInterface $template, array $templateParams = array()) { // ensure we have no html tags in txt template $content = $template->getContent(); $content = $template->getType() == 'txt' ? strip_tags($content) : $content; $templateParams['user'] = $this->user; $templateRendered = $this->render($content, $templateParams); $subjectRendered = $this->render($template->getSubject(), $templateParams); return array($subjectRendered, $templateRendered); }
/** * Compile email message * * @param EmailTemplateInterface $template * @param array $templateParams * * @return array first element is email subject, second - message */ public function compileMessage(EmailTemplateInterface $template, array $templateParams = []) { $subject = $template->getSubject(); $content = $template->getContent(); $templateRendered = $this->renderWithDefaultFilters($content, $templateParams); $subjectRendered = $this->renderWithDefaultFilters($subject, $templateParams); return [$subjectRendered, $templateRendered]; }
/** * Compile email message * * @param EmailTemplateInterface $template * @param array $templateParams * * @return array first element is email subject, second - message */ public function compileMessage(EmailTemplateInterface $template, array $templateParams = array()) { $templateParams['system'] = $this->variablesProvider->getSystemVariableValues(); $subject = $template->getSubject(); $content = $template->getContent(); if (isset($templateParams['entity'])) { $subject = $this->processDateTimeVariables($subject, $templateParams['entity']); $content = $this->processDateTimeVariables($content, $templateParams['entity']); } $templateRendered = $this->render($content, $templateParams); $subjectRendered = $this->render($subject, $templateParams); return array($subjectRendered, $templateRendered); }