Skip to content

Commit

Permalink
Merge pull request #78 from mageplaza/2.4-develop
Browse files Browse the repository at this point in the history
v4.0.1
  • Loading branch information
DHT-Uri authored May 31, 2021
2 parents f47ba4f + 9682cef commit d992ae0
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 33 deletions.
1 change: 1 addition & 0 deletions Block/Adminhtml/Banner/Edit/Tab/Banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ protected function _prepareForm()
'name' => 'url_banner',
'label' => __('Url'),
'title' => __('Url'),
'class' => 'validate-url validate-no-html-tags'
]);

$newTab = $fieldset->addField('newtab', 'select', [
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/Slider/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function _prepareForm()
[
'data' => [
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', ['id' => $this->getRequest()->getParam('id')]),
'action' => $this->getUrl('*/*/save', ['slider_id' => $this->getRequest()->getParam('slider_id')]),
'method' => 'post',
'enctype' => 'multipart/form-data'
]
Expand Down
2 changes: 1 addition & 1 deletion Block/Slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,6 @@ public function getBannerOptions()
*/
public function isLazyLoad()
{
return $this->helperData->getModuleConfig('mpbannerslider_design/lazyLoad');
return $this->helperData->getModuleConfig('mpbannerslider_design/lazyLoad') || $this->getSlider()->getData('lazyLoad');
}
}
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Banner/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function execute()
$resultRedirect->setPath(
'mpbannerslider/*/edit',
[
'banner_id' => $banner->getId(),
'banner_id' => $id,
'_current' => true
]
);
Expand Down
5 changes: 5 additions & 0 deletions Controller/Adminhtml/Slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Registry;
use Mageplaza\BannerSlider\Model\SliderFactory;

Expand Down Expand Up @@ -68,6 +69,7 @@ public function __construct(
* Init Slider
*
* @return \Mageplaza\BannerSlider\Model\Slider
* @throws LocalizedException
*/
protected function initSlider()
{
Expand All @@ -76,6 +78,9 @@ protected function initSlider()
$slider = $this->sliderFactory->create();
if ($sliderId) {
$slider->load($sliderId);
if (!$slider->getId()) {
throw new LocalizedException(__('The wrong slider is specified.'));
}
}
$this->coreRegistry->register('mpbannerslider_slider', $slider);

Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Slider/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function execute()
$resultRedirect->setPath(
'mpbannerslider/*/edit',
[
'slider_id' => $slider->getId(),
'slider_id' => $id,
'_current' => true
]
);
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/Slider/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,16 @@ public function execute()
return $resultRedirect;
} catch (RuntimeException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
if ($slider->getId()) {
$this->_redirect('mpbannerslider/*/edit', ['slider_id' => $slider->getId()]);
} else {
$this->_redirect('mpbannerslider/*/new');
}
} catch (Exception $e) {
$this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the Slider.'));
$this->_redirect('mpbannerslider/*/edit', [
'slider_id' => $slider->getId()
]);
}

$this->_getSession()->setMageplazaBannerSliderSliderData($data);
Expand Down
2 changes: 1 addition & 1 deletion Model/Banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function getIdentities()
*/
public function getDefaultValues()
{
return ['status => 1', 'type' => '0'];
return ['status' => '1', 'type' => '0'];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Observer/AddBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function execute(Observer $observer)
$type = array_search($observer->getEvent()->getElementName(), [
'header' => 'header',
'content' => 'content',
'page-top' => 'main.content',
'page-top' => 'page.wrapper',
'footer-container' => 'footer-container',
'sidebar' => 'catalog.leftnav'
], true);
Expand Down
2 changes: 1 addition & 1 deletion Setup/InstallSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
],
'Slider ID'
)
->addColumn('name', Table::TYPE_TEXT, 255, ['nullable => false'], 'Slider Name')
->addColumn('name', Table::TYPE_TEXT, 255, ['nullable' => false], 'Slider Name')
->addColumn('status', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Status')
->addColumn('location', Table::TYPE_TEXT, 1000, [], 'Location')
->addColumn('store_ids', Table::TYPE_TEXT, 255, [])
Expand Down
52 changes: 26 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"name": "mageplaza/module-banner-slider",
"description": "Magento 2 Banner Slider extension",
"require": {
"mageplaza/module-core": "^1.4.5"
},
"type": "magento2-module",
"version": "4.0.0",
"license": "proprietary",
"authors": [
{
"name": "Mageplaza",
"email": "[email protected]",
"homepage": "https://www.mageplaza.com",
"role": "Technical Support"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Mageplaza\\BannerSlider\\": ""
}
}
}
{
"name": "mageplaza/module-banner-slider",
"description": "Magento 2 Banner Slider extension",
"require": {
"mageplaza/module-core": "^1.4.5"
},
"type": "magento2-module",
"version": "4.0.1",
"license": "proprietary",
"authors": [
{
"name": "Mageplaza",
"email": "[email protected]",
"homepage": "https://www.mageplaza.com",
"role": "Technical Support"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Mageplaza\\BannerSlider\\": ""
}
}
}

0 comments on commit d992ae0

Please sign in to comment.