Render Coupon block in email body

[MAILPOET-4678]
This commit is contained in:
Sam Najian
2023-01-09 22:31:53 +01:00
committed by Aschepikov
parent 54d9b517dd
commit bb7775f87b
3 changed files with 68 additions and 1 deletions

View File

@@ -37,6 +37,9 @@ class Renderer {
/** @var Placeholder */
private $placeholder;
/** @var Coupon */
private $coupon;
public function __construct(
AutomatedLatestContentBlock $ALC,
Button $button,
@@ -47,7 +50,8 @@ class Renderer {
Social $social,
Spacer $spacer,
Text $text,
Placeholder $placeholder
Placeholder $placeholder,
Coupon $coupon
) {
$this->ALC = $ALC;
$this->button = $button;
@@ -59,6 +63,7 @@ class Renderer {
$this->spacer = $spacer;
$this->text = $text;
$this->placeholder = $placeholder;
$this->coupon = $coupon;
}
public function render(NewsletterEntity $newsletter, $data) {
@@ -120,6 +125,8 @@ class Renderer {
return $this->text->render($block);
case 'placeholder':
return $this->placeholder->render($block);
case Coupon::TYPE:
return $this->coupon->render($block, $columnBaseWidth);
}
return "<!-- Skipped unsupported block type: {$block['type']} -->";
}