diff --git a/Block/Adminhtml/Banner.php b/Block/Adminhtml/Banner.php index a171f63..8daffa9 100644 --- a/Block/Adminhtml/Banner.php +++ b/Block/Adminhtml/Banner.php @@ -36,9 +36,9 @@ class Banner extends Container */ protected function _construct() { - $this->_controller = 'adminhtml_banner'; - $this->_blockGroup = 'Mageplaza_BannerSlider'; - $this->_headerText = __('Banners'); + $this->_controller = 'adminhtml_banner'; + $this->_blockGroup = 'Mageplaza_BannerSlider'; + $this->_headerText = __('Banners'); $this->_addButtonLabel = __('Create New Banner'); parent::_construct(); diff --git a/Block/Adminhtml/Banner/Edit.php b/Block/Adminhtml/Banner/Edit.php index 18a6692..b4f4a57 100644 --- a/Block/Adminhtml/Banner/Edit.php +++ b/Block/Adminhtml/Banner/Edit.php @@ -63,7 +63,7 @@ public function __construct( */ protected function _construct() { - $this->_objectId = 'banner_id'; + $this->_objectId = 'banner_id'; $this->_blockGroup = 'Mageplaza_BannerSlider'; $this->_controller = 'adminhtml_banner'; parent::_construct(); @@ -71,12 +71,12 @@ protected function _construct() $this->buttonList->add( 'save-and-continue', [ - 'label' => __('Save and Continue Edit'), - 'class' => 'save', + 'label' => __('Save and Continue Edit'), + 'class' => 'save', 'data_attribute' => [ 'mage-init' => [ 'button' => [ - 'event' => 'saveAndContinueEdit', + 'event' => 'saveAndContinueEdit', 'target' => '#edit_form' ] ] diff --git a/Block/Adminhtml/Banner/Edit/Form.php b/Block/Adminhtml/Banner/Edit/Form.php index b36bf13..cde31e9 100644 --- a/Block/Adminhtml/Banner/Edit/Form.php +++ b/Block/Adminhtml/Banner/Edit/Form.php @@ -75,9 +75,9 @@ protected function _prepareForm() $form = $this->_formFactory->create( [ 'data' => [ - 'id' => 'edit_form', - 'action' => $this->getUrl('*/*/save', ['id' => $this->getRequest()->getParam('id')]), - 'method' => 'post', + 'id' => 'edit_form', + 'action' => $this->getUrl('*/*/save', ['id' => $this->getRequest()->getParam('id')]), + 'method' => 'post', 'enctype' => 'multipart/form-data' ] ] diff --git a/Block/Adminhtml/Banner/Edit/Tab/Banner.php b/Block/Adminhtml/Banner/Edit/Tab/Banner.php index 8448cac..330240b 100644 --- a/Block/Adminhtml/Banner/Edit/Tab/Banner.php +++ b/Block/Adminhtml/Banner/Edit/Tab/Banner.php @@ -115,13 +115,13 @@ public function __construct( WysiwygConfig $wysiwygConfig, array $data = [] ) { - $this->typeOptions = $typeOptions; - $this->template = $template; - $this->statusOptions = $statusOptions; - $this->imageHelper = $imageHelper; - $this->_fieldFactory = $fieldFactory; + $this->typeOptions = $typeOptions; + $this->template = $template; + $this->statusOptions = $statusOptions; + $this->imageHelper = $imageHelper; + $this->_fieldFactory = $fieldFactory; $this->_objectConverter = $objectConverter; - $this->_wysiwygConfig = $wysiwygConfig; + $this->_wysiwygConfig = $wysiwygConfig; parent::__construct($context, $registry, $formFactory, $data); } @@ -174,12 +174,12 @@ protected function _prepareForm() { /** @var \Mageplaza\BannerSlider\Model\Banner $banner */ $banner = $this->_coreRegistry->registry('mpbannerslider_banner'); - $form = $this->_formFactory->create(); + $form = $this->_formFactory->create(); $form->setHtmlIdPrefix('banner_'); $form->setFieldNameSuffix('banner'); $fieldset = $form->addFieldset('base_fieldset', [ 'legend' => __('Banner Information'), - 'class' => 'fieldset-wide' + 'class' => 'fieldset-wide' ]); if ($banner->getId()) { @@ -191,89 +191,89 @@ protected function _prepareForm() } $fieldset->addField('name', 'text', [ - 'name' => 'name', - 'label' => __('Name'), - 'title' => __('Name'), + 'name' => 'name', + 'label' => __('Name'), + 'title' => __('Name'), 'required' => true, ]); $fieldset->addField('status', 'select', [ - 'name' => 'status', - 'label' => __('Status'), - 'title' => __('Status'), + 'name' => 'status', + 'label' => __('Status'), + 'title' => __('Status'), 'values' => $this->statusOptions->toOptionArray(), ]); $typeBanner = $fieldset->addField('type', 'select', [ - 'name' => 'type', - 'label' => __('Type'), - 'title' => __('Type'), + 'name' => 'type', + 'label' => __('Type'), + 'title' => __('Type'), 'values' => $this->typeOptions->toOptionArray(), ]); $uploadBanner = $fieldset->addField('image', BannerImage::class, [ - 'name' => 'image', + 'name' => 'image', 'label' => __('Upload Image'), 'title' => __('Upload Image'), - 'path' => $this->imageHelper->getBaseMediaPath(HelperImage::TEMPLATE_MEDIA_TYPE_BANNER) + 'path' => $this->imageHelper->getBaseMediaPath(HelperImage::TEMPLATE_MEDIA_TYPE_BANNER) ]); $titleBanner = $fieldset->addField('title', 'text', [ - 'name' => 'title', + 'name' => 'title', 'label' => __('Banner title'), 'title' => __('Banner title'), ]); $urlBanner = $fieldset->addField('url_banner', 'text', [ - 'name' => 'url_banner', + 'name' => 'url_banner', 'label' => __('Url'), 'title' => __('Url'), ]); $newTab = $fieldset->addField('newtab', 'select', [ - 'name' => 'newtab', - 'label' => __('Open new tab after click'), - 'title' => __('Open new tab after click'), + 'name' => 'newtab', + 'label' => __('Open new tab after click'), + 'title' => __('Open new tab after click'), 'values' => $this->statusOptions->toOptionArray(), - 'note' => __('Automatically open new tab after clicking on the banner') + 'note' => __('Automatically open new tab after clicking on the banner') ]); if (!$banner->getId()) { $defaultImage = array_values(Data::jsonDecode($this->template->getImageUrls()))[0]; $demoTemplate = $fieldset->addField('default_template', 'select', [ - 'name' => 'default_template', - 'label' => __('Demo template'), - 'title' => __('Demo template'), + 'name' => 'default_template', + 'label' => __('Demo template'), + 'title' => __('Demo template'), 'values' => $this->template->toOptionArray(), - 'note' => 'demo' + 'note' => 'demo' ]); $insertVariableButton = $this->getLayout()->createBlock(Button::class, '', [ 'data' => [ - 'type' => 'button', + 'type' => 'button', 'label' => __('Load Template'), ] ]); - $insertButton = $fieldset->addField('load_template', 'note', [ - 'text' => $insertVariableButton->toHtml(), + $insertButton = $fieldset->addField('load_template', 'note', [ + 'text' => $insertVariableButton->toHtml(), 'label' => '' ]); } $content = $fieldset->addField('content', 'editor', [ - 'name' => 'content', + 'name' => 'content', 'required' => false, - 'config' => $this->_wysiwygConfig->getConfig([ - 'hidden' => true, - 'add_variables' => false, - 'add_widgets' => false, + 'config' => $this->_wysiwygConfig->getConfig([ + 'hidden' => true, + 'add_variables' => false, + 'add_widgets' => false, 'add_directives' => true ]) ]); $fieldset->addField('sliders_ids', Slider::class, [ - 'name' => 'sliders_ids', + 'name' => 'sliders_ids', 'label' => __('Sliders'), 'title' => __('Sliders'), ]); diff --git a/Block/Adminhtml/Banner/Edit/Tab/Render/Image.php b/Block/Adminhtml/Banner/Edit/Tab/Render/Image.php index 3791a88..ab9d13c 100644 --- a/Block/Adminhtml/Banner/Edit/Tab/Render/Image.php +++ b/Block/Adminhtml/Banner/Edit/Tab/Render/Image.php @@ -86,7 +86,7 @@ public function getElementHtml() { $html = ''; - if ((string) $this->getValue()) { + if ((string)$this->getValue()) { $url = $this->_getUrl(); if (!preg_match("/^http\:\/\/|https\:\/\//", $url)) { diff --git a/Block/Adminhtml/Banner/Edit/Tab/Render/Slider.php b/Block/Adminhtml/Banner/Edit/Tab/Render/Slider.php index d75c1c8..2af2215 100644 --- a/Block/Adminhtml/Banner/Edit/Tab/Render/Slider.php +++ b/Block/Adminhtml/Banner/Edit/Tab/Render/Slider.php @@ -67,7 +67,7 @@ public function __construct( array $data = [] ) { $this->collectionFactory = $collectionFactory; - $this->authorization = $authorization; + $this->authorization = $authorization; parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } @@ -141,10 +141,10 @@ public function getSliderCollection() $collection = $this->collectionFactory->create(); $sliderById = []; foreach ($collection as $slider) { - $sliderId = $slider->getId(); - $sliderById[$sliderId]['value'] = $sliderId; + $sliderId = $slider->getId(); + $sliderById[$sliderId]['value'] = $sliderId; $sliderById[$sliderId]['is_active'] = 1; - $sliderById[$sliderId]['label'] = $slider->getName(); + $sliderById[$sliderId]['label'] = $slider->getName(); } return $sliderById; diff --git a/Block/Adminhtml/Config/Field/Responsive.php b/Block/Adminhtml/Config/Field/Responsive.php index f0e851e..7d32416 100644 --- a/Block/Adminhtml/Config/Field/Responsive.php +++ b/Block/Adminhtml/Config/Field/Responsive.php @@ -43,7 +43,7 @@ protected function _prepareToRender() ['label' => __('Number of items'), 'renderer' => false, 'class' => 'required-entry validate-digits'] ); - $this->_addAfter = false; + $this->_addAfter = false; $this->_addButtonLabel = __('Add'); } } diff --git a/Block/Adminhtml/Slider.php b/Block/Adminhtml/Slider.php index 236cfa1..8a01499 100644 --- a/Block/Adminhtml/Slider.php +++ b/Block/Adminhtml/Slider.php @@ -36,9 +36,9 @@ class Slider extends Container */ protected function _construct() { - $this->_controller = 'adminhtml_slider'; - $this->_blockGroup = 'Mageplaza_BannerSlider'; - $this->_headerText = __('Sliders'); + $this->_controller = 'adminhtml_slider'; + $this->_blockGroup = 'Mageplaza_BannerSlider'; + $this->_headerText = __('Sliders'); $this->_addButtonLabel = __('Create New Slider'); parent::_construct(); diff --git a/Block/Adminhtml/Slider/Edit.php b/Block/Adminhtml/Slider/Edit.php index e50357c..4011c9a 100644 --- a/Block/Adminhtml/Slider/Edit.php +++ b/Block/Adminhtml/Slider/Edit.php @@ -63,7 +63,7 @@ public function __construct( */ protected function _construct() { - $this->_objectId = 'slider_id'; + $this->_objectId = 'slider_id'; $this->_blockGroup = 'Mageplaza_BannerSlider'; $this->_controller = 'adminhtml_slider'; parent::_construct(); @@ -71,12 +71,12 @@ protected function _construct() $this->buttonList->add( 'save-and-continue', [ - 'label' => __('Save and Continue Edit'), - 'class' => 'save', + 'label' => __('Save and Continue Edit'), + 'class' => 'save', 'data_attribute' => [ 'mage-init' => [ 'button' => [ - 'event' => 'saveAndContinueEdit', + 'event' => 'saveAndContinueEdit', 'target' => '#edit_form' ] ] diff --git a/Block/Adminhtml/Slider/Edit/Form.php b/Block/Adminhtml/Slider/Edit/Form.php index 81baba0..fbfe6ab 100644 --- a/Block/Adminhtml/Slider/Edit/Form.php +++ b/Block/Adminhtml/Slider/Edit/Form.php @@ -40,9 +40,9 @@ protected function _prepareForm() $form = $this->_formFactory->create( [ 'data' => [ - 'id' => 'edit_form', - 'action' => $this->getUrl('*/*/save', ['id' => $this->getRequest()->getParam('id')]), - 'method' => 'post', + 'id' => 'edit_form', + 'action' => $this->getUrl('*/*/save', ['id' => $this->getRequest()->getParam('id')]), + 'method' => 'post', 'enctype' => 'multipart/form-data' ] ] diff --git a/Block/Adminhtml/Slider/Edit/Tab/Banner.php b/Block/Adminhtml/Slider/Edit/Tab/Banner.php index bd561c8..3682c96 100644 --- a/Block/Adminhtml/Slider/Edit/Tab/Banner.php +++ b/Block/Adminhtml/Slider/Edit/Tab/Banner.php @@ -82,8 +82,8 @@ public function __construct( array $data = [] ) { $this->bannerCollectionFactory = $bannerCollectionFactory; - $this->coreRegistry = $coreRegistry; - $this->bannerFactory = $bannerFactory; + $this->coreRegistry = $coreRegistry; + $this->bannerFactory = $bannerFactory; parent::__construct($context, $backendHelper, $data); } @@ -142,60 +142,60 @@ protected function _prepareColumns() { $this->addColumn('in_banners', [ 'header_css_class' => 'a-center', - 'type' => 'checkbox', - 'name' => 'in_banner', - 'values' => $this->_getSelectedBanners(), - 'align' => 'center', - 'index' => 'banner_id' + 'type' => 'checkbox', + 'name' => 'in_banner', + 'values' => $this->_getSelectedBanners(), + 'align' => 'center', + 'index' => 'banner_id' ]); $this->addColumn('banner_id', [ - 'header' => __('ID'), - 'sortable' => true, - 'index' => 'banner_id', - 'type' => 'number', + 'header' => __('ID'), + 'sortable' => true, + 'index' => 'banner_id', + 'type' => 'number', 'header_css_class' => 'col-id', 'column_css_class' => 'col-id' ]); $this->addColumn('image', [ - 'header' => __('Image'), - 'index' => 'image', + 'header' => __('Image'), + 'index' => 'image', 'header_css_class' => 'col-image', 'column_css_class' => 'col-image', - 'sortable' => false, - 'renderer' => GridImage::class + 'sortable' => false, + 'renderer' => GridImage::class ]); $this->addColumn('name', [ - 'header' => __('Name'), - 'index' => 'name', + 'header' => __('Name'), + 'index' => 'name', 'header_css_class' => 'col-name', 'column_css_class' => 'col-name' ]); $this->addColumn('type', [ - 'header' => __('Type'), - 'index' => 'type', + 'header' => __('Type'), + 'index' => 'type', 'header_css_class' => 'col-type', 'column_css_class' => 'col-type', - 'renderer' => Type::class + 'renderer' => Type::class ]); $this->addColumn('status', [ - 'header' => __('Status'), - 'index' => 'status', + 'header' => __('Status'), + 'index' => 'status', 'header_css_class' => 'col-status', 'column_css_class' => 'col-status', - 'renderer' => Status::class + 'renderer' => Status::class ]); $this->addColumn('position', [ - 'header' => __('Position'), - 'name' => 'position', - 'type' => 'number', + 'header' => __('Position'), + 'name' => 'position', + 'type' => 'number', 'validate_class' => 'validate-number validate-zero-or-greater validate-digits', - 'index' => 'position', - 'editable' => true, + 'index' => 'position', + 'editable' => true, ]); return $this; diff --git a/Block/Adminhtml/Slider/Edit/Tab/Design.php b/Block/Adminhtml/Slider/Edit/Tab/Design.php index 4de3413..29f9950 100644 --- a/Block/Adminhtml/Slider/Edit/Tab/Design.php +++ b/Block/Adminhtml/Slider/Edit/Tab/Design.php @@ -67,7 +67,7 @@ public function __construct( array $data = [] ) { $this->_effect = $effect; - $this->_yesno = $yesno; + $this->_yesno = $yesno; parent::__construct($context, $registry, $formFactory, $data); } @@ -85,79 +85,79 @@ protected function _prepareForm() $form->setFieldNameSuffix('slider'); $fieldset = $form->addFieldset('base_fieldset', [ 'legend' => __('Design'), - 'class' => 'fieldset-wide' + 'class' => 'fieldset-wide' ]); $fieldset->addField('effect', 'select', [ - 'name' => 'effect', - 'label' => __('Animation Effect'), - 'title' => __('Animation Effect'), + 'name' => 'effect', + 'label' => __('Animation Effect'), + 'title' => __('Animation Effect'), 'values' => $this->_effect->toOptionArray() ]); - $design = $fieldset->addField('design', 'select', [ - 'name' => 'design', - 'label' => __('Manually Design'), - 'title' => __('Manually Design'), + $design = $fieldset->addField('design', 'select', [ + 'name' => 'design', + 'label' => __('Manually Design'), + 'title' => __('Manually Design'), 'options' => [ '0' => __('Use Config'), '1' => __('Yes') ] ]); - $responsive = $fieldset->addField('is_responsive', 'select', [ - 'name' => 'is_responsive', - 'label' => __('Is Responsive'), - 'title' => __('Is Responsive'), + $responsive = $fieldset->addField('is_responsive', 'select', [ + 'name' => 'is_responsive', + 'label' => __('Is Responsive'), + 'title' => __('Is Responsive'), 'values' => $this->_yesno->toOptionArray() ]); $responsiveItem = $fieldset->addField('responsive_items', Responsive::class, [ - 'name' => 'responsive_items', + 'name' => 'responsive_items', 'label' => __('Max Items Slider'), 'title' => __('Max Items Slider'), ]); - $autoWidth = $fieldset->addField('autoWidth', 'select', [ - 'name' => 'autoWidth', - 'label' => __('Auto Width'), - 'title' => __('Auto Width'), + $autoWidth = $fieldset->addField('autoWidth', 'select', [ + 'name' => 'autoWidth', + 'label' => __('Auto Width'), + 'title' => __('Auto Width'), 'values' => $this->_yesno->toOptionArray() ]); - $autoHeight = $fieldset->addField('autoHeight', 'select', [ - 'name' => 'autoHeight', - 'label' => __('Auto Height'), - 'title' => __('Auto Height'), + $autoHeight = $fieldset->addField('autoHeight', 'select', [ + 'name' => 'autoHeight', + 'label' => __('Auto Height'), + 'title' => __('Auto Height'), 'values' => $this->_yesno->toOptionArray() ]); - $loop = $fieldset->addField('loop', 'select', [ - 'name' => 'loop', - 'label' => __('Infinity Loop'), - 'title' => __('Infinity Loop'), + $loop = $fieldset->addField('loop', 'select', [ + 'name' => 'loop', + 'label' => __('Infinity Loop'), + 'title' => __('Infinity Loop'), 'values' => $this->_yesno->toOptionArray() ]); - $nav = $fieldset->addField('nav', 'select', [ - 'name' => 'nav', - 'label' => __('Show Next/Prev Buttons'), - 'title' => __('Show Next/Prev Buttons'), + $nav = $fieldset->addField('nav', 'select', [ + 'name' => 'nav', + 'label' => __('Show Next/Prev Buttons'), + 'title' => __('Show Next/Prev Buttons'), 'values' => $this->_yesno->toOptionArray() ]); - $dots = $fieldset->addField('dots', 'select', [ - 'name' => 'dots', - 'label' => __('Show Dots Navigation'), - 'title' => __('Show Dots Navigation'), + $dots = $fieldset->addField('dots', 'select', [ + 'name' => 'dots', + 'label' => __('Show Dots Navigation'), + 'title' => __('Show Dots Navigation'), 'values' => $this->_yesno->toOptionArray() ]); - $lazyload = $fieldset->addField('lazyLoad', 'select', [ - 'name' => 'lazyLoad', - 'label' => __('Lazy Loading Images'), - 'title' => __('Lazy Loading Images'), + $lazyload = $fieldset->addField('lazyLoad', 'select', [ + 'name' => 'lazyLoad', + 'label' => __('Lazy Loading Images'), + 'title' => __('Lazy Loading Images'), 'values' => $this->_yesno->toOptionArray() ]); - $autoplay = $fieldset->addField('autoplay', 'select', [ - 'name' => 'autoplay', - 'label' => __('Autoplay'), - 'title' => __('Autoplay'), + $autoplay = $fieldset->addField('autoplay', 'select', [ + 'name' => 'autoplay', + 'label' => __('Autoplay'), + 'title' => __('Autoplay'), 'values' => $this->_yesno->toOptionArray() ]); - $timeout = $fieldset->addField('autoplayTimeout', 'text', [ - 'name' => 'autoplayTimeout', + $timeout = $fieldset->addField('autoplayTimeout', 'text', [ + 'name' => 'autoplayTimeout', 'label' => __('Autoplay Time-Out'), 'title' => __('Autoplay Time-Out') ]); diff --git a/Block/Adminhtml/Slider/Edit/Tab/Renderer/Snippet.php b/Block/Adminhtml/Slider/Edit/Tab/Renderer/Snippet.php index 06354fe..1b5ff88 100644 --- a/Block/Adminhtml/Slider/Edit/Tab/Renderer/Snippet.php +++ b/Block/Adminhtml/Slider/Edit/Tab/Renderer/Snippet.php @@ -35,17 +35,17 @@ class Snippet extends AbstractElement public function getElementHtml() { $sliderId = $this->getSliderId() ?? 1; - $html = ''; + $html = ''; return $html; } diff --git a/Block/Adminhtml/Slider/Edit/Tab/Slider.php b/Block/Adminhtml/Slider/Edit/Tab/Slider.php index 3ca6822..d90c35d 100644 --- a/Block/Adminhtml/Slider/Edit/Tab/Slider.php +++ b/Block/Adminhtml/Slider/Edit/Tab/Slider.php @@ -102,12 +102,12 @@ public function __construct( Store $systemStore, array $data = [] ) { - $this->statusOptions = $statusOptions; - $this->_location = $location; - $this->_groupRepository = $groupRepository; + $this->statusOptions = $statusOptions; + $this->_location = $location; + $this->_groupRepository = $groupRepository; $this->_searchCriteriaBuilder = $searchCriteriaBuilder; - $this->_objectConverter = $objectConverter; - $this->_systemStore = $systemStore; + $this->_objectConverter = $objectConverter; + $this->_systemStore = $systemStore; parent::__construct($context, $registry, $formFactory, $data); } @@ -120,28 +120,28 @@ protected function _prepareForm() { /** @var \Mageplaza\BannerSlider\Model\Slider $slider */ $slider = $this->_coreRegistry->registry('mpbannerslider_slider'); - $form = $this->_formFactory->create(); + $form = $this->_formFactory->create(); $form->setHtmlIdPrefix('slider_'); $form->setFieldNameSuffix('slider'); $fieldset = $form->addFieldset('base_fieldset', [ 'legend' => __('Slider Information'), - 'class' => 'fieldset-wide' + 'class' => 'fieldset-wide' ]); if ($slider->getId()) { $fieldset->addField('slider_id', 'hidden', ['name' => 'slider_id']); } $fieldset->addField('name', 'text', [ - 'name' => 'name', - 'label' => __('Name'), - 'title' => __('Name'), + 'name' => 'name', + 'label' => __('Name'), + 'title' => __('Name'), 'required' => true, ]); $fieldset->addField('status', 'select', [ - 'name' => 'status', - 'label' => __('Status'), - 'title' => __('Status'), + 'name' => 'status', + 'label' => __('Status'), + 'title' => __('Status'), 'values' => array_merge(['' => ''], $this->statusOptions->toOptionArray()), ]); @@ -150,73 +150,73 @@ protected function _prepareForm() } if ($this->_storeManager->isSingleStoreMode()) { $fieldset->addField('store_ids', 'hidden', [ - 'name' => 'store_ids', + 'name' => 'store_ids', 'value' => $this->_storeManager->getStore()->getId() ]); } else { /** @var RendererInterface $rendererBlock */ $rendererBlock = $this->getLayout()->createBlock(Element::class); $fieldset->addField('store_ids', 'multiselect', [ - 'name' => 'store_ids', - 'label' => __('Store Views'), - 'title' => __('Store Views'), + 'name' => 'store_ids', + 'label' => __('Store Views'), + 'title' => __('Store Views'), 'required' => true, - 'values' => $this->_systemStore->getStoreValuesForForm(false, true) + 'values' => $this->_systemStore->getStoreValuesForForm(false, true) ])->setRenderer($rendererBlock); } $customerGroups = $this->_groupRepository->getList($this->_searchCriteriaBuilder->create())->getItems(); $fieldset->addField('customer_group_ids', 'multiselect', [ - 'name' => 'customer_group_ids[]', - 'label' => __('Customer Groups'), - 'title' => __('Customer Groups'), + 'name' => 'customer_group_ids[]', + 'label' => __('Customer Groups'), + 'title' => __('Customer Groups'), 'required' => true, - 'values' => $this->_objectConverter->toOptionArray($customerGroups, 'id', 'code'), - 'note' => __('Select customer group(s) to display the slider to') + 'values' => $this->_objectConverter->toOptionArray($customerGroups, 'id', 'code'), + 'note' => __('Select customer group(s) to display the slider to') ]); $fieldset->addField('location', 'multiselect', [ - 'name' => 'location', - 'label' => __('Position'), - 'title' => __('Position'), - 'values' => $this->_location->toOptionArray(), - 'note' => __('Select the position to display block.'), + 'name' => 'location', + 'label' => __('Position'), + 'title' => __('Position'), + 'values' => $this->_location->toOptionArray(), + 'note' => __('Select the position to display block.'), 'required' => true, ]); $fieldset->addField('from_date', 'date', [ - 'name' => 'from_date', - 'label' => __('Display from'), - 'title' => __('Display from'), - 'date_format' => 'M/d/yyyy', + 'name' => 'from_date', + 'label' => __('Display from'), + 'title' => __('Display from'), + 'date_format' => 'M/d/yyyy', 'input_format' => DateTime::DATE_INTERNAL_FORMAT, - 'timezone' => false + 'timezone' => false ]); $fieldset->addField('to_date', 'date', [ - 'name' => 'to_date', - 'label' => __('Display to'), - 'title' => __('Display to'), - 'date_format' => 'M/d/yyyy', + 'name' => 'to_date', + 'label' => __('Display to'), + 'title' => __('Display to'), + 'date_format' => 'M/d/yyyy', 'input_format' => DateTime::DATE_INTERNAL_FORMAT, - 'timezone' => false + 'timezone' => false ]); $fieldset->addField('priority', 'text', [ - 'name' => 'priority', + 'name' => 'priority', 'label' => __('Priority'), 'class' => 'validate-digits', - 'note' => __('Enter a number to set priority for the slider. A lower number represents a higher priority.') + 'note' => __('Enter a number to set priority for the slider. A lower number represents a higher priority.') ]); $subfieldset = $form->addFieldset('sub_fieldset', [ 'legend' => __('Another way to add sliders to your page'), - 'class' => 'fieldset-wide' + 'class' => 'fieldset-wide' ]); $subfieldset->addField('snippet', Snippet::class, [ - 'name' => 'snippet', - 'label' => __('How to use'), - 'title' => __('How to use'), + 'name' => 'snippet', + 'label' => __('How to use'), + 'title' => __('How to use'), 'slider_id' => $slider->getId(), ]); diff --git a/Block/Slider.php b/Block/Slider.php index a06e413..5e46212 100644 --- a/Block/Slider.php +++ b/Block/Slider.php @@ -79,11 +79,11 @@ public function __construct( FilterProvider $filterProvider, array $data = [] ) { - $this->helperData = $helperData; + $this->helperData = $helperData; $this->customerRepository = $customerRepository; - $this->store = $context->getStoreManager(); - $this->_date = $dateTime; - $this->filterProvider = $filterProvider; + $this->store = $context->getStoreManager(); + $this->_date = $dateTime; + $this->filterProvider = $filterProvider; parent::__construct($context, $data); } @@ -142,4 +142,13 @@ public function getBannerOptions() { return $this->helperData->getBannerOptions($this->getSlider()); } + + + /** + * @return array|mixed + */ + public function isLazyLoad() + { + return $this->helperData->getModuleConfig('mpbannerslider_design/lazyLoad'); + } } diff --git a/Block/Widget.php b/Block/Widget.php index 595680a..fbcae07 100644 --- a/Block/Widget.php +++ b/Block/Widget.php @@ -43,7 +43,7 @@ public function getBannerCollection() } $sliderCollection = $this->helperData->getActiveSliders(); - $slider = $sliderCollection->addFieldToFilter('slider_id', $sliderId)->getFirstItem(); + $slider = $sliderCollection->addFieldToFilter('slider_id', $sliderId)->getFirstItem(); $this->setSlider($slider); return parent::getBannerCollection(); diff --git a/Controller/Adminhtml/Banner.php b/Controller/Adminhtml/Banner.php index 31bbf9f..9c1fc06 100644 --- a/Controller/Adminhtml/Banner.php +++ b/Controller/Adminhtml/Banner.php @@ -66,7 +66,7 @@ public function __construct( Context $context ) { $this->bannerFactory = $bannerFactory; - $this->coreRegistry = $coreRegistry; + $this->coreRegistry = $coreRegistry; parent::__construct($context); } @@ -78,7 +78,7 @@ public function __construct( */ protected function initBanner() { - $bannerId = (int) $this->getRequest()->getParam('banner_id'); + $bannerId = (int)$this->getRequest()->getParam('banner_id'); /** @var \Mageplaza\BannerSlider\Model\Banner $banner */ $banner = $this->bannerFactory->create(); if ($bannerId) { diff --git a/Controller/Adminhtml/Banner/Edit.php b/Controller/Adminhtml/Banner/Edit.php index 8b014c0..8912a34 100644 --- a/Controller/Adminhtml/Banner/Edit.php +++ b/Controller/Adminhtml/Banner/Edit.php @@ -82,7 +82,7 @@ public function execute() 'mpbannerslider/*/edit', [ 'banner_id' => $banner->getId(), - '_current' => true + '_current' => true ] ); diff --git a/Controller/Adminhtml/Banner/InlineEdit.php b/Controller/Adminhtml/Banner/InlineEdit.php index a6824f3..51e0dfb 100644 --- a/Controller/Adminhtml/Banner/InlineEdit.php +++ b/Controller/Adminhtml/Banner/InlineEdit.php @@ -63,7 +63,7 @@ public function __construct( BannerFactory $bannerFactory, Context $context ) { - $this->jsonFactory = $jsonFactory; + $this->jsonFactory = $jsonFactory; $this->bannerFactory = $bannerFactory; parent::__construct($context); @@ -76,13 +76,13 @@ public function execute() { /** @var Json $resultJson */ $resultJson = $this->jsonFactory->create(); - $error = false; - $messages = []; - $postItems = $this->getRequest()->getParam('items', []); + $error = false; + $messages = []; + $postItems = $this->getRequest()->getParam('items', []); if (!(!empty($postItems) && $this->getRequest()->getParam('isAjax'))) { return $resultJson->setData([ 'messages' => [__('Please correct the data sent.')], - 'error' => true, + 'error' => true, ]); } foreach (array_keys($postItems) as $bannerId) { @@ -94,19 +94,19 @@ public function execute() $banner->save(); } catch (RuntimeException $e) { $messages[] = $this->getErrorWithBannerId($banner, $e->getMessage()); - $error = true; + $error = true; } catch (Exception $e) { $messages[] = $this->getErrorWithBannerId( $banner, __('Something went wrong while saving the Banner.') ); - $error = true; + $error = true; } } return $resultJson->setData([ 'messages' => $messages, - 'error' => $error + 'error' => $error ]); } diff --git a/Controller/Adminhtml/Banner/MassDelete.php b/Controller/Adminhtml/Banner/MassDelete.php index 8845e15..199fdf9 100644 --- a/Controller/Adminhtml/Banner/MassDelete.php +++ b/Controller/Adminhtml/Banner/MassDelete.php @@ -65,7 +65,7 @@ public function __construct( CollectionFactory $collectionFactory, Context $context ) { - $this->filter = $filter; + $this->filter = $filter; $this->collectionFactory = $collectionFactory; parent::__construct($context); diff --git a/Controller/Adminhtml/Banner/MassStatus.php b/Controller/Adminhtml/Banner/MassStatus.php index 2434032..8c769e7 100644 --- a/Controller/Adminhtml/Banner/MassStatus.php +++ b/Controller/Adminhtml/Banner/MassStatus.php @@ -64,7 +64,7 @@ public function __construct( Filter $filter, CollectionFactory $collectionFactory ) { - $this->filter = $filter; + $this->filter = $filter; $this->collectionFactory = $collectionFactory; parent::__construct($context); @@ -76,8 +76,8 @@ public function __construct( */ public function execute() { - $collection = $this->filter->getCollection($this->collectionFactory->create()); - $status = (int) $this->getRequest()->getParam('status'); + $collection = $this->filter->getCollection($this->collectionFactory->create()); + $status = (int)$this->getRequest()->getParam('status'); $bannerUpdated = 0; foreach ($collection as $banner) { try { diff --git a/Controller/Adminhtml/Banner/Save.php b/Controller/Adminhtml/Banner/Save.php index 564d7e1..a1f5f79 100644 --- a/Controller/Adminhtml/Banner/Save.php +++ b/Controller/Adminhtml/Banner/Save.php @@ -71,7 +71,7 @@ public function __construct( Context $context ) { $this->imageHelper = $imageHelper; - $this->jsHelper = $jsHelper; + $this->jsHelper = $jsHelper; parent::__construct($bannerFactory, $registry, $context); } @@ -84,7 +84,7 @@ public function execute() $resultRedirect = $this->resultRedirectFactory->create(); if ($this->getRequest()->getPost('banner')) { - $data = $this->getRequest()->getPost('banner'); + $data = $this->getRequest()->getPost('banner'); $banner = $this->initBanner(); if ($data['type'] === Type::IMAGE) { $this->imageHelper->uploadImage($data, 'image', Image::TEMPLATE_MEDIA_TYPE_BANNER, $banner->getImage()); @@ -104,7 +104,7 @@ public function execute() $this->_eventManager->dispatch( 'mpbannerslider_banner_prepare_save', [ - 'banner' => $banner, + 'banner' => $banner, 'request' => $this->getRequest() ] ); @@ -117,7 +117,7 @@ public function execute() 'mpbannerslider/*/edit', [ 'banner_id' => $banner->getId(), - '_current' => true + '_current' => true ] ); @@ -137,7 +137,7 @@ public function execute() 'mpbannerslider/*/edit', [ 'banner_id' => $banner->getId(), - '_current' => true + '_current' => true ] ); diff --git a/Controller/Adminhtml/Slider.php b/Controller/Adminhtml/Slider.php index 7bdf501..373897b 100644 --- a/Controller/Adminhtml/Slider.php +++ b/Controller/Adminhtml/Slider.php @@ -59,7 +59,7 @@ public function __construct( Context $context ) { $this->sliderFactory = $sliderFactory; - $this->coreRegistry = $coreRegistry; + $this->coreRegistry = $coreRegistry; parent::__construct($context); } @@ -71,7 +71,7 @@ public function __construct( */ protected function initSlider() { - $sliderId = (int) $this->getRequest()->getParam('slider_id'); + $sliderId = (int)$this->getRequest()->getParam('slider_id'); /** @var \Mageplaza\BannerSlider\Model\Slider $slider */ $slider = $this->sliderFactory->create(); if ($sliderId) { diff --git a/Controller/Adminhtml/Slider/Edit.php b/Controller/Adminhtml/Slider/Edit.php index 7d41c75..e0db0e9 100644 --- a/Controller/Adminhtml/Slider/Edit.php +++ b/Controller/Adminhtml/Slider/Edit.php @@ -83,7 +83,7 @@ public function execute() 'mpbannerslider/*/edit', [ 'slider_id' => $slider->getId(), - '_current' => true + '_current' => true ] ); diff --git a/Controller/Adminhtml/Slider/InlineEdit.php b/Controller/Adminhtml/Slider/InlineEdit.php index 7a70522..7be7f84 100644 --- a/Controller/Adminhtml/Slider/InlineEdit.php +++ b/Controller/Adminhtml/Slider/InlineEdit.php @@ -63,7 +63,7 @@ public function __construct( SliderFactory $sliderFactory, Context $context ) { - $this->jsonFactory = $jsonFactory; + $this->jsonFactory = $jsonFactory; $this->sliderFactory = $sliderFactory; parent::__construct($context); @@ -76,13 +76,13 @@ public function execute() { /** @var Json $resultJson */ $resultJson = $this->jsonFactory->create(); - $error = false; - $messages = []; - $postItems = $this->getRequest()->getParam('items', []); + $error = false; + $messages = []; + $postItems = $this->getRequest()->getParam('items', []); if (!(!empty($postItems) && $this->getRequest()->getParam('isAjax'))) { return $resultJson->setData([ 'messages' => [__('Please correct the data sent.')], - 'error' => true, + 'error' => true, ]); } foreach (array_keys($postItems) as $sliderId) { @@ -94,19 +94,19 @@ public function execute() $slider->save(); } catch (RuntimeException $e) { $messages[] = $this->getErrorWithSliderId($slider, $e->getMessage()); - $error = true; + $error = true; } catch (Exception $e) { $messages[] = $this->getErrorWithSliderId( $slider, __('Something went wrong while saving the Banner.') ); - $error = true; + $error = true; } } return $resultJson->setData([ 'messages' => $messages, - 'error' => $error + 'error' => $error ]); } diff --git a/Controller/Adminhtml/Slider/MassDelete.php b/Controller/Adminhtml/Slider/MassDelete.php index f98386d..0e1a76d 100644 --- a/Controller/Adminhtml/Slider/MassDelete.php +++ b/Controller/Adminhtml/Slider/MassDelete.php @@ -65,7 +65,7 @@ public function __construct( CollectionFactory $collectionFactory, Context $context ) { - $this->filter = $filter; + $this->filter = $filter; $this->collectionFactory = $collectionFactory; parent::__construct($context); diff --git a/Controller/Adminhtml/Slider/MassStatus.php b/Controller/Adminhtml/Slider/MassStatus.php index 4bd36f6..95ad8ea 100644 --- a/Controller/Adminhtml/Slider/MassStatus.php +++ b/Controller/Adminhtml/Slider/MassStatus.php @@ -64,7 +64,7 @@ public function __construct( Filter $filter, CollectionFactory $collectionFactory ) { - $this->filter = $filter; + $this->filter = $filter; $this->collectionFactory = $collectionFactory; parent::__construct($context); @@ -76,8 +76,8 @@ public function __construct( */ public function execute() { - $collection = $this->filter->getCollection($this->collectionFactory->create()); - $status = (int) $this->getRequest()->getParam('status'); + $collection = $this->filter->getCollection($this->collectionFactory->create()); + $status = (int)$this->getRequest()->getParam('status'); $sliderUpdated = 0; foreach ($collection as $slider) { try { diff --git a/Controller/Adminhtml/Slider/Save.php b/Controller/Adminhtml/Slider/Save.php index 96e5025..a209aca 100644 --- a/Controller/Adminhtml/Slider/Save.php +++ b/Controller/Adminhtml/Slider/Save.php @@ -79,8 +79,8 @@ public function __construct( Date $dateFilter, DataPersistorInterface $dataPersistor ) { - $this->jsHelper = $jsHelper; - $this->_dateFilter = $dateFilter; + $this->jsHelper = $jsHelper; + $this->_dateFilter = $dateFilter; $this->dataPersistor = $dataPersistor; parent::__construct($sliderFactory, $registry, $context); @@ -94,17 +94,17 @@ public function execute() $resultRedirect = $this->resultRedirectFactory->create(); if ($this->getRequest()->getPost('slider')) { - $data = $this->_filterData($this->getRequest()->getPost('slider')); + $data = $this->_filterData($this->getRequest()->getPost('slider')); $slider = $this->initSlider(); $fromDate = $toDate = null; if (isset($data['from_date']) && isset($data['to_date'])) { $fromDate = $data['from_date']; - $toDate = $data['to_date']; + $toDate = $data['to_date']; } if ($fromDate && $toDate) { $fromDate = new DateTime($fromDate); - $toDate = new DateTime($toDate); + $toDate = new DateTime($toDate); if ($fromDate > $toDate) { $this->messageManager->addErrorMessage(__('End Date must follow Start Date.')); @@ -125,7 +125,7 @@ public function execute() $this->_eventManager->dispatch( 'mpbannerslider_slider_prepare_save', [ - 'slider' => $slider, + 'slider' => $slider, 'request' => $this->getRequest() ] ); @@ -134,13 +134,12 @@ public function execute() $slider->save(); $this->messageManager->addSuccess(__('The Slider has been saved.')); $this->_session->setMageplazaBannerSliderSliderData(false); - $this->dataPersistor->set('mpbannerslider_slider', $data); if ($this->getRequest()->getParam('back')) { $resultRedirect->setPath( 'mpbannerslider/*/edit', [ 'slider_id' => $slider->getId(), - '_current' => true + '_current' => true ] ); @@ -160,7 +159,7 @@ public function execute() 'mpbannerslider/*/edit', [ 'slider_id' => $slider->getId(), - '_current' => true + '_current' => true ] ); @@ -182,7 +181,7 @@ public function execute() protected function _filterData($data) { $inputFilter = new Zend_Filter_Input(['from_date' => $this->_dateFilter,], [], $data); - $data = $inputFilter->getUnescaped(); + $data = $inputFilter->getUnescaped(); if (isset($data['responsive_items'])) { unset($data['responsive_items']['__empty']); diff --git a/Helper/Data.php b/Helper/Data.php index cd52333..813a1d2 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -83,8 +83,8 @@ public function __construct( StoreManagerInterface $storeManager, ObjectManagerInterface $objectManager ) { - $this->date = $date; - $this->httpContext = $httpContext; + $this->date = $date; + $this->httpContext = $httpContext; $this->bannerFactory = $bannerFactory; $this->sliderFactory = $sliderFactory; @@ -104,9 +104,9 @@ public function getBannerOptions($slider) $config = $this->getModuleConfig('mpbannerslider_design'); } - $defaultOpt = $this->getDefaultConfig($config); + $defaultOpt = $this->getDefaultConfig($config); $responsiveOpt = $this->getResponsiveConfig($slider); - $effectOpt = $this->getEffectConfig($slider); + $effectOpt = $this->getEffectConfig($slider); $sliderOptions = array_merge($defaultOpt, $responsiveOpt, $effectOpt); @@ -126,7 +126,7 @@ public function getDefaultConfig($configs) $key, ['autoWidth', 'autoHeight', 'loop', 'nav', 'dots', 'lazyLoad', 'autoplay', 'autoplayTimeout'] )) { - $basicConfig[$key] = (int) $value; + $basicConfig[$key] = (int)$value; } } @@ -141,7 +141,7 @@ public function getDefaultConfig($configs) public function getResponsiveConfig($slider = null) { $defaultResponsive = $this->getModuleConfig('mpbannerslider_design/responsive'); - $sliderResponsive = $slider->getIsResponsive(); + $sliderResponsive = $slider->getIsResponsive(); if ((!$defaultResponsive && !$sliderResponsive) || (!$sliderResponsive && $slider->getDesign())) { return ['items' => 1]; @@ -159,8 +159,8 @@ public function getResponsiveConfig($slider = null) $result = []; foreach ($responsiveItems as $config) { - $size = $config['size'] ?: 0; - $items = $config['items'] ?: 0; + $size = $config['size'] ?: 0; + $items = $config['items'] ?: 0; $result[$size] = ['items' => $items]; } diff --git a/Helper/Image.php b/Helper/Image.php index 053ffe9..eac1b61 100644 --- a/Helper/Image.php +++ b/Helper/Image.php @@ -29,7 +29,7 @@ */ class Image extends Media { - const TEMPLATE_MEDIA_PATH = 'mageplaza/bannerslider'; + const TEMPLATE_MEDIA_PATH = 'mageplaza/bannerslider'; const TEMPLATE_MEDIA_TYPE_BANNER = 'banner/image'; const TEMPLATE_MEDIA_TYPE_SLIDER = 'slider/image'; } diff --git a/Model/Banner.php b/Model/Banner.php index 93a262a..64df456 100644 --- a/Model/Banner.php +++ b/Model/Banner.php @@ -119,7 +119,7 @@ public function __construct( array $data = [] ) { $this->sliderCollectionFactory = $sliderCollectionFactory; - $this->imageModel = $configImage; + $this->imageModel = $configImage; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -195,6 +195,6 @@ public function getSliderIds() $this->setData('slider_ids', $ids); } - return (array) $this->getData('slider_ids'); + return (array)$this->getData('slider_ids'); } } diff --git a/Model/Config/Source/Effect.php b/Model/Config/Source/Effect.php index c61aa91..21eac5a 100644 --- a/Model/Config/Source/Effect.php +++ b/Model/Config/Source/Effect.php @@ -29,15 +29,15 @@ */ class Effect implements ArrayInterface { - const SLIDER = 'slider'; - const FADE_OUT = 'fadeOut'; - const ROTATE_OUT = 'rotateOut'; - const FLIP_OUT = 'flipOutX'; - const ROLL_OUT = 'rollOut'; - const ZOOM_OUT = 'zoomOut'; - const SLIDER_OUT_LEFT = 'slideOutLeft'; + const SLIDER = 'slider'; + const FADE_OUT = 'fadeOut'; + const ROTATE_OUT = 'rotateOut'; + const FLIP_OUT = 'flipOutX'; + const ROLL_OUT = 'rollOut'; + const ZOOM_OUT = 'zoomOut'; + const SLIDER_OUT_LEFT = 'slideOutLeft'; const SLIDER_OUT_RIGHT = 'slideOutRight'; - const LIGHT_SPEED_OUT = 'lightSpeedOut'; + const LIGHT_SPEED_OUT = 'lightSpeedOut'; /** * to option array diff --git a/Model/Config/Source/Location.php b/Model/Config/Source/Location.php index 364e482..3bf9244 100644 --- a/Model/Config/Source/Location.php +++ b/Model/Config/Source/Location.php @@ -29,25 +29,25 @@ */ class Location implements ArrayInterface { - const ALLPAGE_CONTENT_TOP = 'allpage.content-top'; - const ALLPAGE_CONTENT_BOTTOM = 'allpage.content-bottom'; - const ALLPAGE_PAGE_TOP = 'allpage.page-top'; - const ALLPAGE_PAGE_BOTTOM = 'allpage.footer-container'; - const HOMEPAGE_CONTENT_TOP = 'cms_index_index.content-top'; + const ALLPAGE_CONTENT_TOP = 'allpage.content-top'; + const ALLPAGE_CONTENT_BOTTOM = 'allpage.content-bottom'; + const ALLPAGE_PAGE_TOP = 'allpage.page-top'; + const ALLPAGE_PAGE_BOTTOM = 'allpage.footer-container'; + const HOMEPAGE_CONTENT_TOP = 'cms_index_index.content-top'; const HOMEPAGE_CONTENT_BOTTOM = 'cms_index_index.content-bottom'; - const HOMEPAGE_PAGE_TOP = 'cms_index_index.page-top'; - const HOMEPAGE_PAGE_BOTTOM = 'cms_index_index.footer-container'; - const CATEGORY_CONTENT_TOP = 'catalog_category_view.content-top'; + const HOMEPAGE_PAGE_TOP = 'cms_index_index.page-top'; + const HOMEPAGE_PAGE_BOTTOM = 'cms_index_index.footer-container'; + const CATEGORY_CONTENT_TOP = 'catalog_category_view.content-top'; const CATEGORY_CONTENT_BOTTOM = 'catalog_category_view.content-bottom'; - const CATEGORY_PAGE_TOP = 'catalog_category_view.page-top'; - const CATEGORY_PAGE_BOTTOM = 'catalog_category_view.footer-container'; - const CATEGORY_SIDEBAR_TOP = 'catalog_category_view.sidebar-top'; + const CATEGORY_PAGE_TOP = 'catalog_category_view.page-top'; + const CATEGORY_PAGE_BOTTOM = 'catalog_category_view.footer-container'; + const CATEGORY_SIDEBAR_TOP = 'catalog_category_view.sidebar-top'; const CATEGORY_SIDEBAR_BOTTOM = 'catalog_category_view.sidebar-bottom'; - const PRODUCT_CONTENT_TOP = 'catalog_product_view.content-top'; - const PRODUCT_CONTENT_BOTTOM = 'catalog_product_view.content-bottom'; - const PRODUCT_PAGE_TOP = 'catalog_product_view.page-top'; - const PRODUCT_PAGE_BOTTOM = 'catalog_product_view.footer-container'; - const USING_SNIPPET_CODE = 'custom.snippet-code'; + const PRODUCT_CONTENT_TOP = 'catalog_product_view.content-top'; + const PRODUCT_CONTENT_BOTTOM = 'catalog_product_view.content-bottom'; + const PRODUCT_PAGE_TOP = 'catalog_product_view.page-top'; + const PRODUCT_PAGE_BOTTOM = 'catalog_product_view.footer-container'; + const USING_SNIPPET_CODE = 'custom.snippet-code'; /** * Return array of options as value-label pairs diff --git a/Model/Config/Source/SlidersWidget.php b/Model/Config/Source/SlidersWidget.php index 6f7e59b..c5de2b1 100644 --- a/Model/Config/Source/SlidersWidget.php +++ b/Model/Config/Source/SlidersWidget.php @@ -67,7 +67,7 @@ public function toOptionArray() protected function toArray() { $options = []; - $rules = $this->collectionFactory->create() + $rules = $this->collectionFactory->create() ->addActiveFilter() ->addFieldToFilter('location', ['finset' => Location::USING_SNIPPET_CODE]); diff --git a/Model/Config/Source/Template.php b/Model/Config/Source/Template.php index 3c58b6a..5f879da 100644 --- a/Model/Config/Source/Template.php +++ b/Model/Config/Source/Template.php @@ -90,7 +90,7 @@ public function toOptionArray() */ public function getTemplateHtml() { - $imgTmp = '
+ $imgTmp = '
{{imgName}}
diff --git a/Model/Config/Source/Type.php b/Model/Config/Source/Type.php index 8453b2b..5b6c3ca 100644 --- a/Model/Config/Source/Type.php +++ b/Model/Config/Source/Type.php @@ -29,7 +29,7 @@ */ class Type implements ArrayInterface { - const IMAGE = '0'; + const IMAGE = '0'; const CONTENT = '1'; /** diff --git a/Model/ResourceModel/Banner.php b/Model/ResourceModel/Banner.php index 8e87c21..101233c 100644 --- a/Model/ResourceModel/Banner.php +++ b/Model/ResourceModel/Banner.php @@ -67,7 +67,7 @@ public function __construct( ManagerInterface $eventManager, Context $context ) { - $this->date = $date; + $this->date = $date; $this->eventManager = $eventManager; parent::__construct($context); @@ -93,10 +93,10 @@ protected function _construct() public function getBannerNameById($id) { $adapter = $this->getConnection(); - $select = $adapter->select() + $select = $adapter->select() ->from($this->getMainTable(), 'name') ->where('banner_id = :banner_id'); - $binds = ['banner_id' => (int) $id]; + $binds = ['banner_id' => (int)$id]; return $adapter->fetchOne($select, $binds); } @@ -137,15 +137,15 @@ protected function _afterSave(AbstractModel $object) protected function saveSliderRelation(\Mageplaza\BannerSlider\Model\Banner $banner) { $banner->setIsChangedSliderList(false); - $id = $banner->getId(); + $id = $banner->getId(); $sliders = $banner->getSlidersIds(); if ($sliders === null) { return $this; } $oldSliders = $banner->getSliderIds(); - $insert = array_diff($sliders, $oldSliders); - $delete = array_diff($oldSliders, $sliders); + $insert = array_diff($sliders, $oldSliders); + $delete = array_diff($oldSliders, $sliders); $adapter = $this->getConnection(); if (!empty($delete)) { @@ -156,9 +156,9 @@ protected function saveSliderRelation(\Mageplaza\BannerSlider\Model\Banner $bann $data = []; foreach ($insert as $tagId) { $data[] = [ - 'banner_id' => (int) $id, - 'slider_id' => (int) $tagId, - 'position' => 1 + 'banner_id' => (int)$id, + 'slider_id' => (int)$tagId, + 'position' => 1 ]; } $adapter->insertMultiple($this->bannerSliderTable, $data); @@ -186,9 +186,9 @@ protected function saveSliderRelation(\Mageplaza\BannerSlider\Model\Banner $bann public function getSliderIds(\Mageplaza\BannerSlider\Model\Banner $banner) { $adapter = $this->getConnection(); - $select = $adapter->select() + $select = $adapter->select() ->from($this->bannerSliderTable, 'slider_id') - ->where('banner_id = ?', (int) $banner->getId()); + ->where('banner_id = ?', (int)$banner->getId()); return $adapter->fetchCol($select); } diff --git a/Model/ResourceModel/Banner/Collection.php b/Model/ResourceModel/Banner/Collection.php index 18d4dc9..1ea3cdf 100644 --- a/Model/ResourceModel/Banner/Collection.php +++ b/Model/ResourceModel/Banner/Collection.php @@ -103,21 +103,24 @@ public function addFieldToFilter($field, $condition = null) if ($field === 'type' && isset($condition['like'])) { $condition['like'] = str_replace("'%", '', $condition['like']); $condition['like'] = str_replace("%'", '', $condition['like']); - if (stripos('Image', $condition['like']) !== false) { + $condition['like'] = strtolower($condition['like']); + + if (strpos('image', $condition['like']) !== false) { $condition = 0; - } - if (stripos('Advanced', $condition['like']) !== false) { + } elseif (strpos('advanced', $condition['like']) !== false) { $condition = 1; } + } if ($field === 'status' && isset($condition['like'])) { $condition['like'] = str_replace("'%", '', $condition['like']); $condition['like'] = str_replace("%'", '', $condition['like']); - if (stripos('Enable', $condition['like']) !== false) { + $condition['like'] = strtolower($condition['like']); + + if (strpos('enable', $condition['like']) !== false) { $condition = 1; - } - if (stripos('Disable', $condition['like']) !== false) { + } elseif (strpos('disable', $condition['like']) !== false) { $condition = 0; } } diff --git a/Model/ResourceModel/Slider.php b/Model/ResourceModel/Slider.php index a3d3844..9099d39 100644 --- a/Model/ResourceModel/Slider.php +++ b/Model/ResourceModel/Slider.php @@ -76,7 +76,7 @@ public function __construct( Context $context, bannerHelper $helperData ) { - $this->date = $date; + $this->date = $date; $this->eventManager = $eventManager; $this->bannerHelper = $helperData; @@ -105,10 +105,10 @@ protected function _construct() public function getSliderNameById($id) { $adapter = $this->getConnection(); - $select = $adapter->select() + $select = $adapter->select() ->from($this->getMainTable(), 'name') ->where('slider_id = :slider_id'); - $binds = ['slider_id' => (int) $id]; + $binds = ['slider_id' => (int)$id]; return $adapter->fetchOne($select, $binds); } @@ -201,7 +201,7 @@ public function getBannersPosition(\Mageplaza\BannerSlider\Model\Slider $slider) ->where( 'slider_id = :slider_id' ); - $bind = ['slider_id' => (int) $slider->getId()]; + $bind = ['slider_id' => (int)$slider->getId()]; return $this->getConnection()->fetchPairs($select, $bind); } @@ -214,22 +214,22 @@ public function getBannersPosition(\Mageplaza\BannerSlider\Model\Slider $slider) protected function saveBannerRelation(\Mageplaza\BannerSlider\Model\Slider $slider) { $slider->setIsChangedBannerList(false); - $id = $slider->getId(); + $id = $slider->getId(); $banners = $slider->getBannersData(); if ($banners === null) { return $this; } $oldBanners = $slider->getBannersPosition(); - $insert = array_diff_key($banners, $oldBanners); - $delete = array_diff_key($oldBanners, $banners); - $update = array_intersect_key($banners, $oldBanners); - $_update = []; + $insert = array_diff_key($banners, $oldBanners); + $delete = array_diff_key($oldBanners, $banners); + $update = array_intersect_key($banners, $oldBanners); + $_update = []; foreach ($update as $key => $settings) { if (isset($oldBanners[$key]) && $oldBanners[$key] != $settings['position']) { $_update[$key] = $settings; } } - $update = $_update; + $update = $_update; $adapter = $this->getConnection(); if (!empty($delete)) { $condition = ['banner_id IN(?)' => array_keys($delete), 'slider_id=?' => $id]; @@ -239,17 +239,17 @@ protected function saveBannerRelation(\Mageplaza\BannerSlider\Model\Slider $slid $data = []; foreach ($insert as $bannerId => $position) { $data[] = [ - 'slider_id' => (int) $id, - 'banner_id' => (int) $bannerId, - 'position' => (int) $position['position'] + 'slider_id' => (int)$id, + 'banner_id' => (int)$bannerId, + 'position' => (int)$position['position'] ]; } $adapter->insertMultiple($this->sliderBannerTable, $data); } if (!empty($update)) { foreach ($update as $bannerId => $position) { - $where = ['slider_id = ?' => (int) $id, 'banner_id = ?' => (int) $bannerId]; - $bind = ['position' => (int) $position['position']]; + $where = ['slider_id = ?' => (int)$id, 'banner_id = ?' => (int)$bannerId]; + $bind = ['position' => (int)$position['position']]; $adapter->update($this->sliderBannerTable, $bind, $where); } } diff --git a/Model/Slider.php b/Model/Slider.php index 5096260..0ab42ad 100644 --- a/Model/Slider.php +++ b/Model/Slider.php @@ -137,7 +137,7 @@ public function getIdentities() */ public function getDefaultValues() { - $values = []; + $values = []; $values['status'] = '1'; return $values; diff --git a/Observer/AddBlock.php b/Observer/AddBlock.php index 29d0a3b..e53433c 100644 --- a/Observer/AddBlock.php +++ b/Observer/AddBlock.php @@ -56,7 +56,7 @@ public function __construct( RequestInterface $request, Data $helperData ) { - $this->request = $request; + $this->request = $request; $this->helperData = $helperData; } @@ -73,18 +73,18 @@ public function execute(Observer $observer) } $type = array_search($observer->getEvent()->getElementName(), [ - 'header' => 'header', - 'content' => 'content', - 'page-top' => 'main.content', + 'header' => 'header', + 'content' => 'content', + 'page-top' => 'main.content', 'footer-container' => 'footer-container', - 'sidebar' => 'catalog.leftnav' + 'sidebar' => 'catalog.leftnav' ], true); if ($type !== false) { /** @var Layout $layout */ - $layout = $observer->getEvent()->getLayout(); + $layout = $observer->getEvent()->getLayout(); $fullActionName = $this->request->getFullActionName(); - $output = $observer->getTransport()->getOutput(); + $output = $observer->getTransport()->getOutput(); foreach ($this->helperData->getActiveSliders() as $slider) { $locations = array_filter(explode(',', $slider->getLocation())); @@ -101,11 +101,21 @@ public function execute(Observer $observer) ->toHtml(); if (strpos($location, 'top') !== false) { - $output = "
getId()}\"> + if ($type === 'sidebar') { + $output = "
getId()}\"> $content
" . $output; + } else { + $output = "
getId()}\"> + $content
" . $output; + } } else { - $output .= "
getId()}\"> + if ($type === 'sidebar') { + $output .= "
getId()}\"> + $content
"; + } else { + $output .= "
getId()}\"> $content
"; + } } } } diff --git a/Setup/InstallSchema.php b/Setup/InstallSchema.php index dfa67b4..22f15ad 100644 --- a/Setup/InstallSchema.php +++ b/Setup/InstallSchema.php @@ -66,8 +66,8 @@ public function __construct( Filesystem $filesystem, LoggerInterface $logger ) { - $this->logger = $logger; - $this->template = $template; + $this->logger = $logger; + $this->template = $template; $this->fileSystem = $filesystem; } @@ -93,7 +93,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [ 'identity' => true, 'nullable' => false, - 'primary' => true, + 'primary' => true, 'unsigned' => true ], 'Banner ID' @@ -132,7 +132,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [ 'identity' => true, 'nullable' => false, - 'primary' => true, + 'primary' => true, 'unsigned' => true ], 'Slider ID' @@ -246,13 +246,13 @@ private function copyDemoImage() { try { $mediaDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::MEDIA); - $url = 'mageplaza/bannerslider/banner/demo/'; + $url = 'mageplaza/bannerslider/banner/demo/'; $mediaDirectory->create($url); $demos = $this->template->toOptionArray(); foreach ($demos as $demo) { $targetPath = $mediaDirectory->getAbsolutePath($url . $demo['value']); - $DS = DIRECTORY_SEPARATOR; - $oriPath = dirname(__DIR__) . $DS . 'view' . $DS . 'adminhtml' . $DS . 'web' . $DS . 'images' . $DS . $demo['value']; + $DS = DIRECTORY_SEPARATOR; + $oriPath = dirname(__DIR__) . $DS . 'view' . $DS . 'adminhtml' . $DS . 'web' . $DS . 'images' . $DS . $demo['value']; $mediaDirectory->getDriver()->copy($oriPath, $targetPath); } } catch (Exception $e) { diff --git a/Ui/Component/Listing/Column/BannerActions.php b/Ui/Component/Listing/Column/BannerActions.php index 2d1e671..8a9cc4f 100644 --- a/Ui/Component/Listing/Column/BannerActions.php +++ b/Ui/Component/Listing/Column/BannerActions.php @@ -81,7 +81,7 @@ public function prepareDataSource(array $dataSource) if (isset($item['banner_id'])) { $item[$this->getData('name')] = [ 'edit' => [ - 'href' => $this->urlBuilder->getUrl( + 'href' => $this->urlBuilder->getUrl( static::URL_PATH_EDIT, ['banner_id' => $item['banner_id']] ), diff --git a/Ui/Component/Listing/Column/Banners.php b/Ui/Component/Listing/Column/Banners.php index 2f9b496..aafc738 100644 --- a/Ui/Component/Listing/Column/Banners.php +++ b/Ui/Component/Listing/Column/Banners.php @@ -70,8 +70,8 @@ public function prepareDataSource(array $dataSource) if (isset($dataSource['data']['items'])) { foreach ($dataSource['data']['items'] as & $item) { if (isset($item['slider_id'])) { - $id = $item['slider_id']; - $data = $this->helperData->getBannerCollection($id)->getSize(); + $id = $item['slider_id']; + $data = $this->helperData->getBannerCollection($id)->getSize(); $item[$this->getData('name')] = ($data > 0) ? $data . ' banners ' : '' . __("No banner added") . ''; } } diff --git a/Ui/Component/Listing/Column/Content.php b/Ui/Component/Listing/Column/Content.php index 31c3ef0..c893de2 100644 --- a/Ui/Component/Listing/Column/Content.php +++ b/Ui/Component/Listing/Column/Content.php @@ -73,8 +73,8 @@ public function __construct( array $data = [] ) { $this->filterProvider = $filterProvider; - $this->urlBuilder = $urlBuilder; - $this->imageModel = $imageModel; + $this->urlBuilder = $urlBuilder; + $this->imageModel = $imageModel; parent::__construct($context, $uiComponentFactory, $components, $data); } @@ -89,7 +89,7 @@ public function prepareDataSource(array $dataSource) { if (isset($dataSource['data']['items'])) { $fieldName = $this->getData('name'); - $path = $this->imageModel->getBaseUrl(); + $path = $this->imageModel->getBaseUrl(); foreach ($dataSource['data']['items'] as & $item) { $banner = new DataObject($item); if ($item['type'] === Type::IMAGE && $item['image']) { diff --git a/Ui/Component/Listing/Column/CustomerGroup.php b/Ui/Component/Listing/Column/CustomerGroup.php index 4836aaf..420d845 100644 --- a/Ui/Component/Listing/Column/CustomerGroup.php +++ b/Ui/Component/Listing/Column/CustomerGroup.php @@ -65,7 +65,7 @@ public function __construct( array $data = [] ) { $this->groupRepository = $groupRepository; - $this->customerGroup = $GroupCollection; + $this->customerGroup = $GroupCollection; parent::__construct($context, $uiComponentFactory, $components, $data); } @@ -103,7 +103,7 @@ public function prepareDataSource(array $dataSource) */ public function prepareItem(array $item) { - $content = []; + $content = []; $origGroup = $item[$this->getData('name')]; if (!is_array($origGroup)) { $origGroup = explode(',', $origGroup); diff --git a/Ui/Component/Listing/Column/SliderActions.php b/Ui/Component/Listing/Column/SliderActions.php index c9358bc..d1945cb 100644 --- a/Ui/Component/Listing/Column/SliderActions.php +++ b/Ui/Component/Listing/Column/SliderActions.php @@ -81,7 +81,7 @@ public function prepareDataSource(array $dataSource) if (isset($item['slider_id'])) { $item[$this->getData('name')] = [ 'edit' => [ - 'href' => $this->urlBuilder->getUrl( + 'href' => $this->urlBuilder->getUrl( static::URL_PATH_EDIT, [ 'slider_id' => $item['slider_id'] diff --git a/Ui/Component/Listing/Column/SliderLocation.php b/Ui/Component/Listing/Column/SliderLocation.php index eac0abc..31e317f 100644 --- a/Ui/Component/Listing/Column/SliderLocation.php +++ b/Ui/Component/Listing/Column/SliderLocation.php @@ -42,8 +42,8 @@ public function prepareDataSource(array $dataSource) if (isset($dataSource['data']['items'])) { foreach ($dataSource['data']['items'] as & $item) { if (isset($item[$this->getData('name')])) { - $data = $this->getLocation($item[$this->getData('name')]); - $type = array_unique($data['type']); + $data = $this->getLocation($item[$this->getData('name')]); + $type = array_unique($data['type']); $item[$this->getData('name')] = '' . implode(', ', $type) . '
'; } } @@ -60,7 +60,7 @@ public function prepareDataSource(array $dataSource) public function getLocation($data) { $location = []; - $data = explode(',', $data); + $data = explode(',', $data); foreach ($data as $item) { switch ($item) { case Location::ALLPAGE_CONTENT_TOP: diff --git a/Ui/Component/Listing/Column/Store.php b/Ui/Component/Listing/Column/Store.php index af39360..8268af3 100644 --- a/Ui/Component/Listing/Column/Store.php +++ b/Ui/Component/Listing/Column/Store.php @@ -80,8 +80,8 @@ public function __construct( $storeKey = 'store_ids' ) { $this->systemStore = $systemStore; - $this->escaper = $escaper; - $this->storeKey = $storeKey; + $this->escaper = $escaper; + $this->storeKey = $storeKey; parent::__construct($context, $uiComponentFactory, $components, $data); } @@ -113,7 +113,7 @@ public function prepareDataSource(array $dataSource) */ protected function prepareItem(array $item) { - $content = ''; + $content = ''; $origStores = $item[$this->storeKey]; if (!is_array($origStores)) { $origStores = explode(',', $item[$this->storeKey]); diff --git a/composer.json b/composer.json index d808ec8..f1a3b08 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "mageplaza/module-core": "^1.4.5" }, "type": "magento2-module", - "version": "2.0.5", + "version": "4.0.0", "license": "proprietary", "authors": [ { diff --git a/i18n/en_US.csv b/i18n/en_US.csv index 0af9f5c..964e0a4 100644 --- a/i18n/en_US.csv +++ b/i18n/en_US.csv @@ -1,143 +1,143 @@ -Banners,Banners -"Create New Banner","Create New Banner" -"Save Banner","Save Banner" -"Save and Continue Edit","Save and Continue Edit" -"Delete Banner","Delete Banner" -"Edit Banner '%1'","Edit Banner '%1'" -"New Banner","New Banner" -General,General -"Banner Information","Banner Information" -Name,Name -Status,Status -Type,Type -"Upload Image","Upload Image" -"Banner title","Banner title" -Url,Url -"Open new tab after click","Open new tab after click" -"Automatically open new tab after clicking on the banner","Automatically open new tab after clicking on the banner" -"Demo template","Demo template" -"Load Template","Load Template" -Sliders,Sliders -"Screen size from","Screen size from" -"Number of items","Number of items" -Add,Add -"Create New Slider","Create New Slider" -"Save Slider","Save Slider" -"Delete Slider","Delete Slider" -"Edit Slider '%1'","Edit Slider '%1'" -"New Slider","New Slider" -ID,ID -Image,Image -Position,Position -Design,Design -"Animation Effect","Animation Effect" -"Manually Design","Manually Design" -"Use Config","Use Config" -Yes,Yes -"Is Responsive","Is Responsive" -"Max Items Slider","Max Items Slider" -"Auto Width","Auto Width" -"Auto Height","Auto Height" -"Infinity Loop","Infinity Loop" -"Show Next/Prev Buttons","Show Next/Prev Buttons" -"Show Dots Navigation","Show Dots Navigation" -"Lazy Loading Images","Lazy Loading Images" -Autoplay,Autoplay -"Autoplay Time-Out","Autoplay Time-Out" -"Add Widget with name ""Banner Slider widget"" and set ""Slider Id"" for it.","Add Widget with name ""Banner Slider widget"" and set ""Slider Id"" for it." -"CMS Page/Static Block","CMS Page/Static Block" -"You can paste the above block of snippet into any page in Magento 2 and set SliderId for it.","You can paste the above block of snippet into any page in Magento 2 and set SliderId for it." -"Template .phtml file","Template .phtml file" -"Open a .phtml file and insert where you want to display Banner Slider.","Open a .phtml file and insert where you want to display Banner Slider." -"Slider Information","Slider Information" -"Store Views","Store Views" -"Customer Groups","Customer Groups" -"Select customer group(s) to display the slider to","Select customer group(s) to display the slider to" -"Select the position to display block.","Select the position to display block." -"Display from","Display from" -"Display to","Display to" -Priority,Priority -"Enter a number to set priority for the slider. A lower number represents a higher priority.","Enter a number to set priority for the slider. A lower number represents a higher priority." -"Another way to add sliders to your page","Another way to add sliders to your page" -"How to use","How to use" -"The Banner has been deleted.","The Banner has been deleted." -"This Banner no longer exists.","This Banner no longer exists." -"Manage Banners","Manage Banners" -"Please correct the data sent.","Please correct the data sent." -"Something went wrong while saving the Banner.","Something went wrong while saving the Banner." -"A total of %1 record(s) have been deleted.","A total of %1 record(s) have been deleted." -"Something went wrong while updating status for %1.","Something went wrong while updating status for %1." -"A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." -"The Banner has been saved.","The Banner has been saved." -"The slider has been deleted.","The slider has been deleted." -"This Slider no longer exists.","This Slider no longer exists." -"Manage Sliders","Manage Sliders" -"End Date must follow Start Date.","End Date must follow Start Date." -"The Slider has been saved.","The Slider has been saved." -"Something went wrong while saving the Slider.","Something went wrong while saving the Slider." -No,No -fadeOut,fadeOut -rotateOut,rotateOut -flipOut,flipOut -rollOut,rollOut -zoomOut,zoomOut -slideOutLeft,slideOutLeft -slideOutRight,slideOutRight -lightSpeedOut,lightSpeedOut -"All Page","All Page" -"Top of content","Top of content" -"Bottom of content","Bottom of content" -"Top of page","Top of page" -"Bottom of page","Bottom of page" -"Home Page","Home Page" -"Category page","Category page" -"Top of sidebar","Top of sidebar" -"Bottom of sidebar","Bottom of sidebar" -"Product page","Product page" -Custom,Custom -"Using snippet code, widget","Using snippet code, widget" -"Demo template 1","Demo template 1" -"Demo template 2","Demo template 2" -"Demo template 3","Demo template 3" -"Demo template 4","Demo template 4" -"Demo template 5","Demo template 5" -Advanced,Advanced -Edit,Edit -"No banner added","No banner added" -"All Customer Groups","All Customer Groups" -"Category Page","Category Page" -"Product Page","Product Page" -"All Store Views","All Store Views" -"Go to Details Page","Go to Details Page" -"Banner Slider","Banner Slider" -Enable,Enable -"Select Yes to enable this module","Select Yes to enable this module" -"Slider Design Configuration","Slider Design Configuration" -Responsive,Responsive -"Select Yes to use auto-width","Select Yes to use auto-width" -"Select Yes to use auto-height","Select Yes to use auto-height" -"Select Yes to re-display the slider after it shows the last item","Select Yes to re-display the slider after it shows the last item" -"Select Yes to display the Next/Pre buttons in the slider","Select Yes to display the Next/Pre buttons in the slider" -"Select Yes to display dots navigation of the slider","Select Yes to display dots navigation of the slider" -"Select Yes to lazy loading images","Select Yes to lazy loading images" -"Select Yes to allow auto-displaying the next products","Select Yes to allow auto-displaying the next products" -"The time (ms) in which an item is auto-moved to the left","The time (ms) in which an item is auto-moved to the left" -"Mageplaza Banner Slider","Mageplaza Banner Slider" -"Banner Slider list","Banner Slider list" -"Select Slider","Select Slider" -"Add New Banner","Add New Banner" -Delete,Delete -"Are you sure you wan't to delete selected Banners?","Are you sure you wan't to delete selected Banners?" -"Change status","Change status" -Disable,Disable -Banner,Banner -Created,Created -Modified,Modified -"Add New Slider","Add New Slider" -"Delete Sliders","Delete Sliders" -"Are you sure you wan't to delete selected Sliders?","Are you sure you wan't to delete selected Sliders?" -"Number of banner","Number of banner" -"Slider Location","Slider Location" -"Store View","Store View" -"Start Date","Start Date" -"End Date","End Date" +Banners,Banners +"Create New Banner","Create New Banner" +"Save Banner","Save Banner" +"Save and Continue Edit","Save and Continue Edit" +"Delete Banner","Delete Banner" +"Edit Banner '%1'","Edit Banner '%1'" +"New Banner","New Banner" +General,General +"Banner Information","Banner Information" +Name,Name +Status,Status +Type,Type +"Upload Image","Upload Image" +"Banner title","Banner title" +Url,Url +"Open new tab after click","Open new tab after click" +"Automatically open new tab after clicking on the banner","Automatically open new tab after clicking on the banner" +"Demo template","Demo template" +"Load Template","Load Template" +Sliders,Sliders +"Screen size from","Screen size from" +"Number of items","Number of items" +Add,Add +"Create New Slider","Create New Slider" +"Save Slider","Save Slider" +"Delete Slider","Delete Slider" +"Edit Slider '%1'","Edit Slider '%1'" +"New Slider","New Slider" +ID,ID +Image,Image +Position,Position +Design,Design +"Animation Effect","Animation Effect" +"Manually Design","Manually Design" +"Use Config","Use Config" +Yes,Yes +"Is Responsive","Is Responsive" +"Max Items Slider","Max Items Slider" +"Auto Width","Auto Width" +"Auto Height","Auto Height" +"Infinity Loop","Infinity Loop" +"Show Next/Prev Buttons","Show Next/Prev Buttons" +"Show Dots Navigation","Show Dots Navigation" +"Lazy Loading Images","Lazy Loading Images" +Autoplay,Autoplay +"Autoplay Time-Out","Autoplay Time-Out" +"Add Widget with name ""Banner Slider widget"" and set ""Slider Id"" for it.","Add Widget with name ""Banner Slider widget"" and set ""Slider Id"" for it." +"CMS Page/Static Block","CMS Page/Static Block" +"You can paste the above block of snippet into any page in Magento 2 and set SliderId for it.","You can paste the above block of snippet into any page in Magento 2 and set SliderId for it." +"Template .phtml file","Template .phtml file" +"Open a .phtml file and insert where you want to display Banner Slider.","Open a .phtml file and insert where you want to display Banner Slider." +"Slider Information","Slider Information" +"Store Views","Store Views" +"Customer Groups","Customer Groups" +"Select customer group(s) to display the slider to","Select customer group(s) to display the slider to" +"Select the position to display block.","Select the position to display block." +"Display from","Display from" +"Display to","Display to" +Priority,Priority +"Enter a number to set priority for the slider. A lower number represents a higher priority.","Enter a number to set priority for the slider. A lower number represents a higher priority." +"Another way to add sliders to your page","Another way to add sliders to your page" +"How to use","How to use" +"The Banner has been deleted.","The Banner has been deleted." +"This Banner no longer exists.","This Banner no longer exists." +"Manage Banners","Manage Banners" +"Please correct the data sent.","Please correct the data sent." +"Something went wrong while saving the Banner.","Something went wrong while saving the Banner." +"A total of %1 record(s) have been deleted.","A total of %1 record(s) have been deleted." +"Something went wrong while updating status for %1.","Something went wrong while updating status for %1." +"A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." +"The Banner has been saved.","The Banner has been saved." +"The slider has been deleted.","The slider has been deleted." +"This Slider no longer exists.","This Slider no longer exists." +"Manage Sliders","Manage Sliders" +"End Date must follow Start Date.","End Date must follow Start Date." +"The Slider has been saved.","The Slider has been saved." +"Something went wrong while saving the Slider.","Something went wrong while saving the Slider." +No,No +fadeOut,fadeOut +rotateOut,rotateOut +flipOut,flipOut +rollOut,rollOut +zoomOut,zoomOut +slideOutLeft,slideOutLeft +slideOutRight,slideOutRight +lightSpeedOut,lightSpeedOut +"All Page","All Page" +"Top of content","Top of content" +"Bottom of content","Bottom of content" +"Top of page","Top of page" +"Bottom of page","Bottom of page" +"Home Page","Home Page" +"Category page","Category page" +"Top of sidebar","Top of sidebar" +"Bottom of sidebar","Bottom of sidebar" +"Product page","Product page" +Custom,Custom +"Using snippet code, widget","Using snippet code, widget" +"Demo template 1","Demo template 1" +"Demo template 2","Demo template 2" +"Demo template 3","Demo template 3" +"Demo template 4","Demo template 4" +"Demo template 5","Demo template 5" +Advanced,Advanced +Edit,Edit +"No banner added","No banner added" +"All Customer Groups","All Customer Groups" +"Category Page","Category Page" +"Product Page","Product Page" +"All Store Views","All Store Views" +"Go to Details Page","Go to Details Page" +"Banner Slider","Banner Slider" +Enable,Enable +"Select Yes to enable this module","Select Yes to enable this module" +"Slider Design Configuration","Slider Design Configuration" +Responsive,Responsive +"Select Yes to use auto-width","Select Yes to use auto-width" +"Select Yes to use auto-height","Select Yes to use auto-height" +"Select Yes to re-display the slider after it shows the last item","Select Yes to re-display the slider after it shows the last item" +"Select Yes to display the Next/Pre buttons in the slider","Select Yes to display the Next/Pre buttons in the slider" +"Select Yes to display dots navigation of the slider","Select Yes to display dots navigation of the slider" +"Select Yes to lazy loading images","Select Yes to lazy loading images" +"Select Yes to allow auto-displaying the next products","Select Yes to allow auto-displaying the next products" +"The time (ms) in which an item is auto-moved to the left","The time (ms) in which an item is auto-moved to the left" +"Mageplaza Banner Slider","Mageplaza Banner Slider" +"Banner Slider list","Banner Slider list" +"Select Slider","Select Slider" +"Add New Banner","Add New Banner" +Delete,Delete +"Are you sure you wan't to delete selected Banners?","Are you sure you wan't to delete selected Banners?" +"Change status","Change status" +Disable,Disable +Banner,Banner +Created,Created +Modified,Modified +"Add New Slider","Add New Slider" +"Delete Sliders","Delete Sliders" +"Are you sure you wan't to delete selected Sliders?","Are you sure you wan't to delete selected Sliders?" +"Number of banner","Number of banner" +"Slider Location","Slider Location" +"Store View","Store View" +"Start Date","Start Date" +"End Date","End Date" diff --git a/view/frontend/layout/default.xml b/view/frontend/layout/default.xml index 791fa13..13f6f87 100644 --- a/view/frontend/layout/default.xml +++ b/view/frontend/layout/default.xml @@ -25,5 +25,6 @@ + diff --git a/view/frontend/templates/bannerslider.phtml b/view/frontend/templates/bannerslider.phtml index 90d1a6e..d286054 100644 --- a/view/frontend/templates/bannerslider.phtml +++ b/view/frontend/templates/bannerslider.phtml @@ -23,42 +23,51 @@ use Mageplaza\BannerSlider\Model\Config\Source\Type; $banners = $block->getBannerCollection(); $check = is_array($banners) ? !empty($banners) : $banners->getSize(); -if ($check) : ?> +if ($check): ?> getSliderId() . uniqid('-', false); $sliderOptions = $block->getBannerOptions(); ?> -