From e1719c2fb998e5e4b05217b21f465b99354ad820 Mon Sep 17 00:00:00 2001 From: Dmitri Mackert Date: Thu, 18 Apr 2019 11:16:20 +0200 Subject: [PATCH] Enable or Disable the Modal responsiveness --- Block/Popup.php | 3 ++- Helper/Config.php | 16 ++++++++++++++++ etc/adminhtml/system.xml | 5 +++++ etc/config.xml | 1 + view/frontend/web/js/country_modal.js | 3 ++- 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Block/Popup.php b/Block/Popup.php index 33c689d..5fca8a9 100644 --- a/Block/Popup.php +++ b/Block/Popup.php @@ -154,7 +154,8 @@ public function hintedCountry() 'delayDuration' => (int)$this->config->getDelayDuration(), 'cookieLifetime' => (int)$this->config->getCookieDuration(), 'modalContent' => $this->getModalText($lang, $this->getShowForUnselected()), - 'showModalOverlay' => $this->config->getShowModal() + 'showModalOverlay' => $this->config->getShowModal(), + 'responsiveModal' => $this->config->isResponsiveModal() ]; } diff --git a/Helper/Config.php b/Helper/Config.php index bfc7c83..56dcd20 100644 --- a/Helper/Config.php +++ b/Helper/Config.php @@ -93,6 +93,12 @@ class Config extends AbstractHelper const SHOW_MODAL = 'countrypopup/general/show_modal'; + /** + * config path for responsive modal setting + */ + const RESPONSIVE_MODAL = 'countrypopup/general/responsive_modal'; + + /** * fallback detect string */ @@ -215,4 +221,14 @@ public function getShowModal($scope = ScopeInterface::SCOPE_STORE) { return $this->scopeConfig->isSetFlag(self::SHOW_MODAL, $scope); } + + /** + * return true if modal is responsive + * @param string $scope + * @return bool + */ + public function isResponsiveModal($scope = ScopeInterface::SCOPE_STORE) + { + return $this->scopeConfig->isSetFlag(self::RESPONSIVE_MODAL, $scope); + } } \ No newline at end of file diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index f9c4ea6..475da99 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -52,12 +52,17 @@ If the detected country is equal the current store country no hint will be shown.]]> Magento\Config\Model\Config\Source\Yesno + Magento\Config\Model\Config\Source\Yesno + + + Magento\Config\Model\Config\Source\Yesno + diff --git a/etc/config.xml b/etc/config.xml index 23cf26f..7a7bea7 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -23,6 +23,7 @@ 0 1 + 1 1000 diff --git a/view/frontend/web/js/country_modal.js b/view/frontend/web/js/country_modal.js index b878185..775fd47 100644 --- a/view/frontend/web/js/country_modal.js +++ b/view/frontend/web/js/country_modal.js @@ -46,6 +46,7 @@ define([ that.options.delay = (response.useDelay) ? response.delayDuration : 0; that.options.cookie_lifetime = response.cookieLifetime; that.options.show_modal_overlay = response.showModalOverlay; + that.options.modal_responsive = response.responsiveModal; that.prepareModal(response); } }); @@ -74,7 +75,7 @@ define([ var that = this, options = { type: 'popup', - responsive: true, + responsive: this.options.modal_responsive, innerScroll: true, wrapperClass: 'hint-country-modal' },