This commit is contained in:
Benjamin Beganović 2021-04-19 11:41:56 +02:00
parent 875c7ba950
commit 417260e25d
2 changed files with 7 additions and 7 deletions

View File

@ -59,12 +59,12 @@ class TemplateEmail extends Mailable
DesignHelpers::parseMarkdownToHtml($this->build_email->getBody()) DesignHelpers::parseMarkdownToHtml($this->build_email->getBody())
); );
$this->build_email->setBody(
TemplateEngine::wrapElementsIntoTables('<div id="content-wrapper"></div>', $this->build_email->getBody())
);
$settings = $this->client->getMergedSettings(); $settings = $this->client->getMergedSettings();
$this->build_email->setBody(
TemplateEngine::wrapElementsIntoTables('<div id="content-wrapper"></div>', $this->build_email->getBody(), $settings)
);
$company = $this->client->company; $company = $this->client->company;
if($this->invitation) if($this->invitation)

View File

@ -200,7 +200,7 @@ class TemplateEngine
$data = [ $data = [
'subject' => $this->subject, 'subject' => $this->subject,
'body' => self::wrapElementsIntoTables(strtr($wrapper, ['$body' => '']), $this->body), 'body' => self::wrapElementsIntoTables(strtr($wrapper, ['$body' => '']), $this->body, $this->entity_obj->client->getMergedSettings()),
'wrapper' => $wrapper, 'wrapper' => $wrapper,
'raw_body' => $this->raw_body, 'raw_body' => $this->raw_body,
'raw_subject' => $this->raw_subject 'raw_subject' => $this->raw_subject
@ -254,7 +254,7 @@ class TemplateEngine
DB::rollBack(); DB::rollBack();
} }
public static function wrapElementsIntoTables(string $wrapper, string $body): ?string public static function wrapElementsIntoTables(string $wrapper, string $body, $settings): ?string
{ {
$documents['wrapper'] = new \DOMDocument(); $documents['wrapper'] = new \DOMDocument();
$documents['wrapper']->loadHTML($wrapper); $documents['wrapper']->loadHTML($wrapper);
@ -262,7 +262,7 @@ class TemplateEngine
$documents['master'] = new \DOMDocument(); $documents['master'] = new \DOMDocument();
$documents['master']->loadHTML( $documents['master']->loadHTML(
view('email.template.master', ['header' => '', 'slot' => ''])->render() view('email.template.master', ['header' => '', 'slot' => '', 'settings' => $settings])->render()
); );
$styles = $documents['master']->getElementsByTagName('style')->item(0)->nodeValue; $styles = $documents['master']->getElementsByTagName('style')->item(0)->nodeValue;