Respect layout content size set in theme.json in the renderer
[MAILPOET-6249]
This commit is contained in:
committed by
Jan Lysý
parent
06067b36f6
commit
a40eb3e554
@@ -47,6 +47,7 @@ class Renderer {
|
||||
|
||||
$emailStyles = $this->themeController->getStyles($post, $template, true);
|
||||
$templateHtml = $this->contentRenderer->render($post, $template);
|
||||
$layout = $this->themeController->getLayoutSettings();
|
||||
|
||||
ob_start();
|
||||
include self::TEMPLATE_FILE;
|
||||
|
@@ -4,6 +4,13 @@
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
/**
|
||||
* Template file to render the current 'wp_template', specifcally for emails.
|
||||
*
|
||||
* Variables passed to this template:
|
||||
* @var $subject string
|
||||
* @var $preHeader string
|
||||
* @var $templateHtml string
|
||||
* @var $metaRobots string
|
||||
* @var $layout array{contentSize: string}
|
||||
*/
|
||||
?><!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
@@ -18,7 +25,7 @@
|
||||
<!-- Forced Styles -->
|
||||
</head>
|
||||
<body>
|
||||
<div class="email_layout_wrapper">
|
||||
<div class="email_layout_wrapper" style="max-width: <?php echo esc_attr($layout['contentSize']); ?>">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@@ -40,6 +40,7 @@ class RendererTest extends \MailPoetTest {
|
||||
$themeControllerMock = $this->createMock(ThemeController::class);
|
||||
$themeControllerMock->method('getTheme')->willReturn($themeJsonMock);
|
||||
$themeControllerMock->method('getStyles')->willReturn($styles);
|
||||
$themeControllerMock->method('getLayoutSettings')->willReturn(['contentSize' => '660px']);
|
||||
|
||||
$this->renderer = $this->getServiceWithOverrides(Renderer::class, [
|
||||
'settingsController' => $settingsControllerMock,
|
||||
|
Reference in New Issue
Block a user