<?php declare(strict_types = 1); namespace MailPoet\Newsletter\Renderer; if (!defined('ABSPATH')) exit; use MailPoet\Entities\NewsletterEntity; class BodyRenderer { /** @var Blocks\Renderer */ private $blocksRenderer; /** @var Columns\Renderer */ private $columnsRenderer; public function __construct( Blocks\Renderer $blocksRenderer, Columns\Renderer $columnsRenderer ) { $this->blocksRenderer = $blocksRenderer; $this->columnsRenderer = $columnsRenderer; } /** * @param NewsletterEntity $newsletter * @param array $content * @return string */ public function renderBody(NewsletterEntity $newsletter, array $content) { $blocks = (array_key_exists('blocks', $content)) ? $content['blocks'] : []; $renderedContent = []; foreach ($blocks as $contentBlock) { $columnsData = $this->blocksRenderer->render($newsletter, $contentBlock); $renderedContent[] = $this->columnsRenderer->render( $contentBlock, $columnsData ); } return implode('', $renderedContent); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Blocks | Folder | 0755 |
|
|
Columns | Folder | 0755 |
|
|
PostProcess | Folder | 0755 |
|
|
BodyRenderer.php | File | 1.06 KB | 0644 |
|
EscapeHelper.php | File | 1.5 KB | 0644 |
|
Preprocessor.php | File | 3.6 KB | 0644 |
|
Renderer.php | File | 8.77 KB | 0644 |
|
StylesHelper.php | File | 7.26 KB | 0644 |
|
Template.html | File | 4.62 KB | 0644 |
|
index.php | File | 6 B | 0644 |
|