From c1ffc12e1af2954d514788f64fb3dbc55a78eb0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lys=C3=BD?= Date: Fri, 4 Jun 2021 13:59:25 +0200 Subject: [PATCH] Use placeholder block for WooCommerce preprocessing [MAILPOET-3638] --- lib/Newsletter/Renderer/Preprocessor.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/Newsletter/Renderer/Preprocessor.php b/lib/Newsletter/Renderer/Preprocessor.php index cfc4945f21..5e1a0145a6 100644 --- a/lib/Newsletter/Renderer/Preprocessor.php +++ b/lib/Newsletter/Renderer/Preprocessor.php @@ -70,18 +70,14 @@ class Preprocessor { case 'woocommerceHeading': $wcEmailSettings = $this->transactionalEmails->getWCEmailSettings(); $content = self::WC_HEADING_BEFORE . '

' . self::WC_HEADING_PLACEHOLDER . '

' . self::WC_HEADING_AFTER; - return $this->placeholder($content, ['backgroundColor' => $wcEmailSettings['base_color']]); + return $this->renderTextBlock($content, ['backgroundColor' => $wcEmailSettings['base_color']]); case 'woocommerceContent': - return $this->placeholder(self::WC_CONTENT_PLACEHOLDER); + return $this->renderPlaceholderBlock(self::WC_CONTENT_PLACEHOLDER); } return [$block]; } - /** - * @param string $text - * @return array - */ - private function placeholder($text, $styles = []) { + private function renderTextBlock(string $text, array $styles = []): array { return [ LayoutHelper::row([ LayoutHelper::col([[ @@ -91,4 +87,15 @@ class Preprocessor { ], $styles), ]; } + + private function renderPlaceholderBlock(string $placeholder): array { + return [ + LayoutHelper::row([ + LayoutHelper::col([[ + 'type' => 'placeholder', + 'placeholder' => $placeholder, + ]]), + ]), + ]; + } }