Use placeholder block for WooCommerce preprocessing

[MAILPOET-3638]
This commit is contained in:
Jan Lysý
2021-06-04 13:59:25 +02:00
committed by Veljko V
parent 4d5801caa3
commit c1ffc12e1a

View File

@ -70,18 +70,14 @@ class Preprocessor {
case 'woocommerceHeading':
$wcEmailSettings = $this->transactionalEmails->getWCEmailSettings();
$content = self::WC_HEADING_BEFORE . '<h1 style="color:' . $wcEmailSettings['base_text_color'] . ';">' . self::WC_HEADING_PLACEHOLDER . '</h1>' . 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,
]]),
]),
];
}
}