diff --git a/Controller/Adminhtml/Banner.php b/Controller/Adminhtml/Banner.php index b190859..f9875be 100644 --- a/Controller/Adminhtml/Banner.php +++ b/Controller/Adminhtml/Banner.php @@ -36,7 +36,6 @@ abstract class Banner extends \Magento\Backend\App\Action * * @var \Magento\Backend\Model\View\Result\RedirectFactory */ - protected $resultRedirectFactory; /** * constructor @@ -49,13 +48,11 @@ abstract class Banner extends \Magento\Backend\App\Action public function __construct( \Mageplaza\BetterSlider\Model\BannerFactory $bannerFactory, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, \Magento\Backend\App\Action\Context $context ) { $this->bannerFactory = $bannerFactory; $this->coreRegistry = $coreRegistry; - $this->resultRedirectFactory = $resultRedirectFactory; parent::__construct($context); } diff --git a/Controller/Adminhtml/Banner/Edit.php b/Controller/Adminhtml/Banner/Edit.php index c76b227..717a7d9 100644 --- a/Controller/Adminhtml/Banner/Edit.php +++ b/Controller/Adminhtml/Banner/Edit.php @@ -17,12 +17,6 @@ class Edit extends \Mageplaza\BetterSlider\Controller\Adminhtml\Banner { - /** - * Backend session - * - * @var \Magento\Backend\Model\Session - */ - protected $backendSession; /** * Page factory @@ -50,19 +44,16 @@ class Edit extends \Mageplaza\BetterSlider\Controller\Adminhtml\Banner * @param \Magento\Backend\App\Action\Context $context */ public function __construct( - \Magento\Backend\Model\Session $backendSession, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory, \Mageplaza\BetterSlider\Model\BannerFactory $bannerFactory, \Magento\Framework\Registry $registry, - \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, \Magento\Backend\App\Action\Context $context ) { - $this->backendSession = $backendSession; $this->resultPageFactory = $resultPageFactory; $this->resultJsonFactory = $resultJsonFactory; - parent::__construct($bannerFactory, $registry, $resultRedirectFactory, $context); + parent::__construct($bannerFactory, $registry, $context); } /** @@ -80,6 +71,7 @@ protected function _isAllowed() */ public function execute() { + $id = $this->getRequest()->getParam('banner_id'); /** @var \Mageplaza\BetterSlider\Model\Banner $banner */ $banner = $this->initBanner(); @@ -104,7 +96,7 @@ public function execute() } $title = $banner->getId() ? $banner->getName() : __('New Banner'); $resultPage->getConfig()->getTitle()->prepend($title); - $data = $this->backendSession->getData('mageplaza_betterslider_banner_data', true); + $data = $this->_session->getData('mageplaza_betterslider_banner_data', true); if (!empty($data)) { $banner->setData($data); } diff --git a/Controller/Adminhtml/Banner/Save.php b/Controller/Adminhtml/Banner/Save.php index 20e6654..92f1600 100644 --- a/Controller/Adminhtml/Banner/Save.php +++ b/Controller/Adminhtml/Banner/Save.php @@ -31,13 +31,6 @@ class Save extends \Mageplaza\BetterSlider\Controller\Adminhtml\Banner */ protected $imageModel; - /** - * Backend session - * - * @var \Magento\Backend\Model\Session - */ - protected $backendSession; - /** * JS helper * @@ -50,29 +43,24 @@ class Save extends \Mageplaza\BetterSlider\Controller\Adminhtml\Banner * * @param \Mageplaza\BetterSlider\Model\Upload $uploadModel * @param \Mageplaza\BetterSlider\Model\Banner\Image $imageModel - * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Backend\Helper\Js $jsHelper * @param \Mageplaza\BetterSlider\Model\BannerFactory $bannerFactory * @param \Magento\Framework\Registry $registry - * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory * @param \Magento\Backend\App\Action\Context $context */ public function __construct( \Mageplaza\BetterSlider\Model\Upload $uploadModel, \Mageplaza\BetterSlider\Model\Banner\Image $imageModel, - \Magento\Backend\Model\Session $backendSession, \Magento\Backend\Helper\Js $jsHelper, \Mageplaza\BetterSlider\Model\BannerFactory $bannerFactory, \Magento\Framework\Registry $registry, - \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, \Magento\Backend\App\Action\Context $context ) { $this->uploadModel = $uploadModel; $this->imageModel = $imageModel; - $this->backendSession = $backendSession; $this->jsHelper = $jsHelper; - parent::__construct($bannerFactory, $registry, $resultRedirectFactory, $context); + parent::__construct($bannerFactory, $registry, $context); } /** @@ -106,7 +94,7 @@ public function execute() try { $banner->save(); $this->messageManager->addSuccess(__('The Banner has been saved.')); - $this->backendSession->setMageplazaBetterSliderBannerData(false); + $this->_session->setMageplazaBetterSliderBannerData(false); if ($this->getRequest()->getParam('back')) { $resultRedirect->setPath( 'mageplaza_betterslider/*/edit', diff --git a/Controller/Adminhtml/Banner/Sliders.php b/Controller/Adminhtml/Banner/Sliders.php index 3f77825..45af3c0 100644 --- a/Controller/Adminhtml/Banner/Sliders.php +++ b/Controller/Adminhtml/Banner/Sliders.php @@ -30,19 +30,17 @@ class Sliders extends \Mageplaza\BetterSlider\Controller\Adminhtml\Banner * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory * @param \Mageplaza\BetterSlider\Model\BannerFactory $sliderFactory * @param \Magento\Framework\Registry $registry - * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory * @param \Magento\Backend\App\Action\Context $context */ public function __construct( \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory, \Mageplaza\BetterSlider\Model\BannerFactory $sliderFactory, \Magento\Framework\Registry $registry, - \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, \Magento\Backend\App\Action\Context $context ) { $this->resultLayoutFactory = $resultLayoutFactory; - parent::__construct($sliderFactory, $registry, $resultRedirectFactory, $context); + parent::__construct($sliderFactory, $registry, $context); } /** diff --git a/Controller/Adminhtml/Slider.php b/Controller/Adminhtml/Slider.php index 28c5162..d6d37cf 100644 --- a/Controller/Adminhtml/Slider.php +++ b/Controller/Adminhtml/Slider.php @@ -36,26 +36,22 @@ abstract class Slider extends \Magento\Backend\App\Action * * @var \Magento\Backend\Model\View\Result\RedirectFactory */ - protected $resultRedirectFactory; /** * constructor * * @param \Mageplaza\BetterSlider\Model\SliderFactory $sliderFactory * @param \Magento\Framework\Registry $coreRegistry - * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory * @param \Magento\Backend\App\Action\Context $context */ public function __construct( \Mageplaza\BetterSlider\Model\SliderFactory $sliderFactory, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, \Magento\Backend\App\Action\Context $context ) { $this->sliderFactory = $sliderFactory; $this->coreRegistry = $coreRegistry; - $this->resultRedirectFactory = $resultRedirectFactory; parent::__construct($context); } diff --git a/Controller/Adminhtml/Slider/Banners.php b/Controller/Adminhtml/Slider/Banners.php index 5bc8d92..faca85e 100644 --- a/Controller/Adminhtml/Slider/Banners.php +++ b/Controller/Adminhtml/Slider/Banners.php @@ -30,19 +30,17 @@ class Banners extends \Mageplaza\BetterSlider\Controller\Adminhtml\Slider * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory * @param \Mageplaza\BetterSlider\Model\SliderFactory $bannerFactory * @param \Magento\Framework\Registry $registry - * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory * @param \Magento\Backend\App\Action\Context $context */ public function __construct( \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory, \Mageplaza\BetterSlider\Model\SliderFactory $bannerFactory, \Magento\Framework\Registry $registry, - \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, \Magento\Backend\App\Action\Context $context ) { $this->resultLayoutFactory = $resultLayoutFactory; - parent::__construct($bannerFactory, $registry, $resultRedirectFactory, $context); + parent::__construct($bannerFactory, $registry, $context); } /** diff --git a/Controller/Adminhtml/Slider/Edit.php b/Controller/Adminhtml/Slider/Edit.php index 43d08d3..515bea2 100644 --- a/Controller/Adminhtml/Slider/Edit.php +++ b/Controller/Adminhtml/Slider/Edit.php @@ -17,12 +17,6 @@ class Edit extends \Mageplaza\BetterSlider\Controller\Adminhtml\Slider { - /** - * Backend session - * - * @var \Magento\Backend\Model\Session - */ - protected $backendSession; /** * Page factory @@ -41,28 +35,23 @@ class Edit extends \Mageplaza\BetterSlider\Controller\Adminhtml\Slider /** * constructor * - * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory * @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory * @param \Mageplaza\BetterSlider\Model\SliderFactory $sliderFactory * @param \Magento\Framework\Registry $registry - * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory * @param \Magento\Backend\App\Action\Context $context */ public function __construct( - \Magento\Backend\Model\Session $backendSession, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory, \Mageplaza\BetterSlider\Model\SliderFactory $sliderFactory, \Magento\Framework\Registry $registry, - \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, \Magento\Backend\App\Action\Context $context ) { - $this->backendSession = $backendSession; $this->resultPageFactory = $resultPageFactory; $this->resultJsonFactory = $resultJsonFactory; - parent::__construct($sliderFactory, $registry, $resultRedirectFactory, $context); + parent::__construct($sliderFactory, $registry, $context); } /** @@ -104,7 +93,7 @@ public function execute() } $title = $slider->getId() ? $slider->getName() : __('New Slider'); $resultPage->getConfig()->getTitle()->prepend($title); - $data = $this->backendSession->getData('mageplaza_betterslider_slider_data', true); + $data = $this->_session->getData('mageplaza_betterslider_slider_data', true); if (!empty($data)) { $slider->setData($data); } diff --git a/Controller/Adminhtml/Slider/Save.php b/Controller/Adminhtml/Slider/Save.php index da48556..efd0d48 100644 --- a/Controller/Adminhtml/Slider/Save.php +++ b/Controller/Adminhtml/Slider/Save.php @@ -17,12 +17,6 @@ class Save extends \Mageplaza\BetterSlider\Controller\Adminhtml\Slider { - /** - * Backend session - * - * @var \Magento\Backend\Model\Session - */ - protected $backendSession; /** * JS helper @@ -34,25 +28,20 @@ class Save extends \Mageplaza\BetterSlider\Controller\Adminhtml\Slider /** * constructor * - * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Backend\Helper\Js $jsHelper * @param \Mageplaza\BetterSlider\Model\SliderFactory $sliderFactory * @param \Magento\Framework\Registry $registry - * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory * @param \Magento\Backend\App\Action\Context $context */ public function __construct( - \Magento\Backend\Model\Session $backendSession, \Magento\Backend\Helper\Js $jsHelper, \Mageplaza\BetterSlider\Model\SliderFactory $sliderFactory, \Magento\Framework\Registry $registry, - \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, \Magento\Backend\App\Action\Context $context ) { - $this->backendSession = $backendSession; $this->jsHelper = $jsHelper; - parent::__construct($sliderFactory, $registry, $resultRedirectFactory, $context); + parent::__construct($sliderFactory, $registry, $context); } /** @@ -81,7 +70,7 @@ public function execute() try { $slider->save(); $this->messageManager->addSuccess(__('The Slider has been saved.')); - $this->backendSession->setMageplazaBetterSliderSliderData(false); + $this->_session->setMageplazaBetterSliderSliderData(false); if ($this->getRequest()->getParam('back')) { $resultRedirect->setPath( 'mageplaza_betterslider/*/edit', diff --git a/Helper/Data.php b/Helper/Data.php index 3ab2df4..57f8a68 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -1,12 +1,12 @@ urlBuilder = $urlBuilder; $this->fileSystem = $fileSystem; $this->bannerFactory = $bannerFactory; $this->storeManager = $storeManager; @@ -48,7 +45,7 @@ public function __construct( public function getBaseUrl() { - return $this->urlBuilder->getBaseUrl(['_type' => UrlInterface::URL_TYPE_MEDIA]) . $this->subDir . '/image/'; + return $this->_urlBuilder->getBaseUrl(['_type' => UrlInterface::URL_TYPE_MEDIA]) . $this->subDir . '/image/'; } diff --git a/view/frontend/requirejs-config.js b/view/frontend/requirejs-config.js index 31304e7..bcdb845 100644 --- a/view/frontend/requirejs-config.js +++ b/view/frontend/requirejs-config.js @@ -1,15 +1,15 @@ -// var config = { -// map: { -// '*': { -// 'owlcarousel': 'Mageplaza_BetterSlider/js/owl.carousel', -// }, -// }, -// paths: { -// 'owlcarousel': 'Mageplaza_BetterSlider/js/owl.carousel', -// }, -// shim: { -// 'owlcarousel': { -// deps: ['jquery'] -// } -// } -// }; \ No newline at end of file +var config = { + // map: { + // '*': { + // 'owlcarousel': 'Mageplaza_BetterSlider/js/owl.carousel', + // }, + // }, + // paths: { + // 'owlcarousel': 'Mageplaza_BetterSlider/js/owl.carousel', + // }, + // shim: { + // 'owlcarousel': { + // deps: ['jquery'] + // } + // } +}; \ No newline at end of file diff --git a/view/frontend/templates/slider.phtml b/view/frontend/templates/slider.phtml index 5398b55..a6a6f3f 100644 --- a/view/frontend/templates/slider.phtml +++ b/view/frontend/templates/slider.phtml @@ -13,7 +13,8 @@ $autoHeight = $block->getAutoHeight() ? 'true' : 'false';