Template.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Newsletter templates page content block
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\Newsletter\Block\Adminhtml;
  12. class Template extends \Magento\Backend\Block\Template
  13. {
  14. /**
  15. * @var string
  16. */
  17. protected $_template = 'Magento_Newsletter::template/list.phtml';
  18. /**
  19. * @return $this
  20. */
  21. protected function _prepareLayout()
  22. {
  23. $this->getToolbar()->addChild(
  24. 'add_button',
  25. \Magento\Backend\Block\Widget\Button::class,
  26. [
  27. 'label' => __('Add New Template'),
  28. 'onclick' => "window.location='" . $this->getCreateUrl() . "'",
  29. 'class' => 'add primary add-template'
  30. ]
  31. );
  32. $this->setChild(
  33. 'grid',
  34. $this->getLayout()->createBlock(
  35. \Magento\Newsletter\Block\Adminhtml\Template\Grid::class,
  36. 'newsletter.template.grid'
  37. )
  38. );
  39. return parent::_prepareLayout();
  40. }
  41. /**
  42. * Get the url for create
  43. *
  44. * @return string
  45. */
  46. public function getCreateUrl()
  47. {
  48. return $this->getUrl('*/*/new');
  49. }
  50. /**
  51. * Get header text
  52. *
  53. * @return \Magento\Framework\Phrase
  54. */
  55. public function getHeaderText()
  56. {
  57. return __('Newsletter Templates');
  58. }
  59. }