diff --git a/app/Utils/TemplateEngine.php b/app/Utils/TemplateEngine.php
index 7ed921c639da..eac2def3bf8a 100644
--- a/app/Utils/TemplateEngine.php
+++ b/app/Utils/TemplateEngine.php
@@ -198,36 +198,46 @@ class TemplateEngine
$wrapper = str_replace('
', $injection, $wrapper);
}
+ $documents['wrapper'] = new \DOMDocument();
+ $documents['wrapper']->loadHTML($wrapper);
-// $root = new DOMDocument();
-// $root->loadHTML('
-//
-//
-//
-//
-// |
-//
-//
-//
');
-//
-// $node = new DOMDocument();
-// $node->loadXML('This is my content
');
-//
-// $node = $root->importNode($node->documentElement, true);
-//
-//// $root->documentElement->appendChild($node);
-//
-// $root->getElementById('content')->appendChild($node);
-// $root->getElementById('content')->ownerDocument->saveHTML();
-//
-// var_dump($root->getElementById('content')->ownerDocument->saveHTML($root->getElementsByTagName('table')->item(0)));
+ $styles = $documents['wrapper']->getElementsByTagName('style')->item(0)->nodeValue;
- $wrapper_document = new \DOMDocument();
- $wrapper_document->loadHTML($wrapper);
+ $documents['wrapper']->saveHTML();
+
+ $documents['body'] = new \DOMDocument();
+ $documents['body']->loadHTML(empty($this->body) ? '' : (new CssToInlineStyles())->convert($this->body, $styles));
+
+ $table_html ='
+ ';
+
+ foreach ($documents['body']->getElementsByTagName('body')->item(0)->childNodes as $element) {
+ $table = new \DOMDocument();
+
+ $table->loadHTML($table_html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
+
+ $element = $table->importNode($element, true);
+
+ $table->getElementById('table-content')->appendChild($element);
+
+ $node = $documents['wrapper']->importNode($table->documentElement, true);
+
+ $documents['wrapper']->getElementById('content-wrapper')->appendChild($node);
+ }
+
+ $body = $documents['wrapper']->getElementById('content-wrapper')->ownerDocument->saveHTML($documents['wrapper']->getElementById('content-wrapper'));
$data = [
'subject' => $this->subject,
- 'body' => $this->body,
+ 'body' => $body,
'wrapper' => $wrapper,
'raw_body' => $this->raw_body,
'raw_subject' => $this->raw_subject
@@ -281,10 +291,13 @@ class TemplateEngine
DB::rollBack();
}
- private static function inlineMarkupCss(string $css, string $html): ?string
+ private static function cssToInlineStyles(string $css, string $html): ?string
+ {
+ return (new CssToInlineStyles())->convert($html, $css);
+ }
+
+ private static function wrapElementsIntoTables()
{
- $inliner = new CssToInlineStyles();
- return $inliner->convert($html, $css);
}
}
diff --git a/resources/views/email/template/master.blade.php b/resources/views/email/template/master.blade.php
index 05304d60fe0c..09fc5069f0fc 100644
--- a/resources/views/email/template/master.blade.php
+++ b/resources/views/email/template/master.blade.php
@@ -198,40 +198,12 @@
+
+ {{ $slot }}
+
- {{ $slot }}
-
-{{--
--}}
-{{-- --}}
-{{-- --}}
-{{-- --}}
-
-{{-- --}}
-
-{{-- | --}}
-{{--
--}}
-{{-- --}}
-{{--
--}}
-
-{{--
--}}
-{{-- --}}
-{{-- --}}
-{{-- --}}
-
-{{-- --}}
-
-{{-- | --}}
-{{--
--}}
-{{-- --}}
-{{--
--}}
+
+
-
-
-
-
+ @isset($whitelabel)
+ @if(!$whitelabel)
+
+
+
+
-
-
-
+
+
+
-
+
- |
-
-
+ |
+
+
- |
-
-
-
+ |
+
+
+
+ @endif
+ @endisset