Index.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Smartwave\Dailydeals\Controller\Adminhtml\Dailydeal;
  3. class Index extends \Magento\Backend\App\Action
  4. {
  5. /**
  6. * Page result factory
  7. *
  8. * @var \Magento\Framework\View\Result\PageFactory
  9. */
  10. protected $resultPageFactory;
  11. /**
  12. * Page factory
  13. *
  14. * @var \Magento\Backend\Model\View\Result\Page
  15. */
  16. protected $resultPage;
  17. /**
  18. * constructor
  19. *
  20. * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
  21. * @param \Magento\Backend\App\Action\Context $context
  22. */
  23. public function __construct(
  24. \Magento\Framework\View\Result\PageFactory $resultPageFactory,
  25. \Magento\Backend\App\Action\Context $context
  26. ) {
  27. $this->resultPageFactory = $resultPageFactory;
  28. parent::__construct($context);
  29. }
  30. /**
  31. * execute the action
  32. *
  33. * @return \Magento\Backend\Model\View\Result\Page|\Magento\Framework\View\Result\Page
  34. */
  35. public function execute()
  36. {
  37. $this->setPageData();
  38. return $this->getResultPage();
  39. }
  40. /**
  41. * instantiate result page object
  42. *
  43. * @return \Magento\Backend\Model\View\Result\Page|\Magento\Framework\View\Result\Page
  44. */
  45. public function getResultPage()
  46. {
  47. if (is_null($this->resultPage)) {
  48. $this->resultPage = $this->resultPageFactory->create();
  49. }
  50. return $this->resultPage;
  51. }
  52. /**
  53. * set page data
  54. *
  55. * @return $this
  56. */
  57. protected function setPageData()
  58. {
  59. $resultPage = $this->getResultPage();
  60. //$resultPage->setActiveMenu('Smartwave_Dailydeals::dailydeal');
  61. $resultPage->getConfig()->getTitle()->prepend((__('Dailydeals')));
  62. return $this;
  63. }
  64. }