Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Problem.php
Go to the documentation of this file.
1 <?php
7 
9 
18 {
22  protected $_template = 'Magento_Newsletter::problem/list.phtml';
23 
28 
34  public function __construct(
35  \Magento\Backend\Block\Template\Context $context,
36  Collection $problemCollection,
37  array $data = []
38  ) {
39  $this->_problemCollection = $problemCollection;
40  parent::__construct($context, $data);
41  }
42 
47  protected function _construct()
48  {
49  parent::_construct();
50 
51  $collection = $this->_problemCollection->addSubscriberInfo()->addQueueInfo();
52  }
53 
59  protected function _prepareLayout()
60  {
61  $this->setChild(
62  'deleteButton',
63  $this->getLayout()->createBlock(
64  \Magento\Backend\Block\Widget\Button::class,
65  'del.button'
66  )->setData(
67  ['label' => __('Delete Selected Problems'), 'onclick' => 'problemController.deleteSelected();']
68  )
69  );
70 
71  $this->setChild(
72  'unsubscribeButton',
73  $this->getLayout()->createBlock(
74  \Magento\Backend\Block\Widget\Button::class,
75  'unsubscribe.button'
76  )->setData(
77  ['label' => __('Unsubscribe Selected'), 'onclick' => 'problemController.unsubscribe();']
78  )
79  );
80  return parent::_prepareLayout();
81  }
82 
88  public function getUnsubscribeButtonHtml()
89  {
90  return $this->getChildHtml('unsubscribeButton');
91  }
92 
98  public function getDeleteButtonHtml()
99  {
100  return $this->getChildHtml('deleteButton');
101  }
102 
109  public function getShowButtons()
110  {
111  return $this->_problemCollection->getSize() > 0;
112  }
113 }
__()
Definition: __.php:13
__construct(\Magento\Backend\Block\Template\Context $context, Collection $problemCollection, array $data=[])
Definition: Problem.php:34
setData($key, $value=null)
Definition: DataObject.php:72