From 2ce746a15667f1322c59f11be0cee84d5bca9cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lys=C3=BD?= Date: Mon, 11 Dec 2023 17:37:01 +0100 Subject: [PATCH] Fix getting style attribute in the image block In some cases wasn't the style attribute set and it caused type error in calling method for parsing styles. [MAILPOET-5688] --- .../lib/EmailEditor/Integrations/Core/Renderer/Blocks/Image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailpoet/lib/EmailEditor/Integrations/Core/Renderer/Blocks/Image.php b/mailpoet/lib/EmailEditor/Integrations/Core/Renderer/Blocks/Image.php index f3a03ef955..e8ad37b8fe 100644 --- a/mailpoet/lib/EmailEditor/Integrations/Core/Renderer/Blocks/Image.php +++ b/mailpoet/lib/EmailEditor/Integrations/Core/Renderer/Blocks/Image.php @@ -41,7 +41,7 @@ class Image implements BlockRenderer { $html = new \WP_HTML_Tag_Processor($blockContent); if ($html->next_tag(['tag_name' => 'img'])) { // Getting height from styles and if it's set, we set the height attribute - $styles = $html->get_attribute('style'); + $styles = $html->get_attribute('style') ?? ''; $styles = $settingsController->parseStylesToArray($styles); $height = $styles['height'] ?? null; if ($height && is_numeric($settingsController->parseNumberFromStringWithPixels($height))) {