From ad9800ebffca9e600dcfa3b4f46e45a080dbf75d Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 23 May 2024 12:41:35 +0100 Subject: [PATCH] Fix PHP warning for justifyContent --- .../Integrations/Core/Renderer/Blocks/Group.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mailpoet/lib/EmailEditor/Integrations/Core/Renderer/Blocks/Group.php b/mailpoet/lib/EmailEditor/Integrations/Core/Renderer/Blocks/Group.php index 9803b1ff6c..197bf2785d 100644 --- a/mailpoet/lib/EmailEditor/Integrations/Core/Renderer/Blocks/Group.php +++ b/mailpoet/lib/EmailEditor/Integrations/Core/Renderer/Blocks/Group.php @@ -30,9 +30,7 @@ class Group extends AbstractBlockRenderer { 'backgroundColor' => '', 'textColor' => '', 'borderColor' => '', - 'layout' => [ - 'justifyContent' => '', - ], + 'layout' => [], ]); // Layout, background, borders need to be on the outer table element. @@ -52,9 +50,9 @@ class Group extends AbstractBlockRenderer { 'spacing' => [ 'padding' => $blockAttributes['style']['spacing']['padding'] ?? [] ], ])['declarations']; - if (empty($tableStyles['background-size'])) { - $tableStyles['background-size'] = 'cover'; - } + $tableStyles['background-size'] = empty($tableStyles['background-size']) ? 'cover' : $tableStyles['background-size']; + $justifyContent = $blockAttributes['layout']['justifyContent'] ?? 'center'; + $width = $parsedBlock['email_attrs']['width'] ?? '100%'; return sprintf( ' @@ -69,8 +67,8 @@ class Group extends AbstractBlockRenderer { esc_attr(WP_Style_Engine::compile_css($tableStyles, '')), esc_attr(WP_Style_Engine::compile_css($cellStyles, '')), esc_attr($originalClassname), - esc_attr($blockAttributes['layout']['justifyContent'] ?: 'center'), - esc_attr($parsedBlock['email_attrs']['width'] ?: '100%'), + esc_attr($justifyContent), + esc_attr($width), ); } }