Use DI in block renderer
[MAILPOET-2899]
This commit is contained in:
@@ -32,15 +32,16 @@ class Preprocessor {
|
||||
|
||||
/**
|
||||
* @param array $content
|
||||
* @param array $newsletter
|
||||
* @return array
|
||||
*/
|
||||
public function process($content) {
|
||||
public function process($newsletter, $content) {
|
||||
if (!array_key_exists('blocks', $content)) {
|
||||
return $content;
|
||||
}
|
||||
$blocks = [];
|
||||
foreach ($content['blocks'] as $block) {
|
||||
$blocks = array_merge($blocks, $this->processBlock($block));
|
||||
$blocks = array_merge($blocks, $this->processBlock($newsletter, $block));
|
||||
}
|
||||
$content['blocks'] = $blocks;
|
||||
return $content;
|
||||
@@ -48,12 +49,13 @@ class Preprocessor {
|
||||
|
||||
/**
|
||||
* @param array $block
|
||||
* @param array $newsletter
|
||||
* @return array
|
||||
*/
|
||||
public function processBlock($block) {
|
||||
public function processBlock($newsletter, $block) {
|
||||
switch ($block['type']) {
|
||||
case 'automatedLatestContentLayout':
|
||||
return $this->blocksRenderer->automatedLatestContentTransformedPosts($block);
|
||||
return $this->blocksRenderer->automatedLatestContentTransformedPosts($newsletter, $block);
|
||||
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;
|
||||
|
Reference in New Issue
Block a user