1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Newsletter\Block\Adminhtml\Queue;
/**
* Newsletter template preview block
*
* @api
* @since 100.0.2
*/
class Preview extends \Magento\Newsletter\Block\Adminhtml\Template\Preview
{
/**
* {@inheritdoc}
*/
protected $profilerName = "newsletter_queue_proccessing";
/**
* @var \Magento\Newsletter\Model\QueueFactory
*/
protected $_queueFactory;
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Newsletter\Model\TemplateFactory $templateFactory
* @param \Magento\Newsletter\Model\QueueFactory $queueFactory
* @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Newsletter\Model\TemplateFactory $templateFactory,
\Magento\Newsletter\Model\SubscriberFactory $subscriberFactory,
\Magento\Newsletter\Model\QueueFactory $queueFactory,
array $data = []
) {
$this->_queueFactory = $queueFactory;
parent::__construct($context, $templateFactory, $subscriberFactory, $data);
}
/**
* @param \Magento\Newsletter\Model\Template $template
* @param string $id
* @return $this
*/
protected function loadTemplate(\Magento\Newsletter\Model\Template $template, $id)
{
/** @var \Magento\Newsletter\Model\Queue $queue */
$queue = $this->_queueFactory->create()->load($id);
$template->setTemplateType($queue->getNewsletterType());
$template->setTemplateText($queue->getNewsletterText());
$template->setTemplateStyles($queue->getNewsletterStyles());
return $this;
}
}