diff --git a/Block/Adminhtml/System/Coordinate.php b/Block/Adminhtml/System/Coordinate.php index 0ede093..b71391a 100644 --- a/Block/Adminhtml/System/Coordinate.php +++ b/Block/Adminhtml/System/Coordinate.php @@ -55,8 +55,7 @@ public function __construct( Context $context, Data $helperData, array $data = [] - ) - { + ) { $this->helperData = $helperData; parent::__construct($context, $data); @@ -65,7 +64,7 @@ public function __construct( /** * Render fieldset html * - * @param \Magento\Framework\Data\Form\Element\AbstractElement $element + * @param AbstractElement $element * * @return string */ diff --git a/Block/Map.php b/Block/Map.php index 6fe0744..04cf115 100644 --- a/Block/Map.php +++ b/Block/Map.php @@ -53,8 +53,7 @@ public function __construct( Context $context, Data $helperData, array $data = [] - ) - { + ) { $this->helperData = $helperData; parent::__construct($context, $data); @@ -107,7 +106,7 @@ public function getMapMarkerIcon() */ public function getMapZoomDefault() { - return ((int)$this->helperData->getMapConfig('zoom_default')) ?: 20; + return ((int) $this->helperData->getMapConfig('zoom_default')) ?: 20; } /** @@ -117,7 +116,7 @@ public function getMapZoomDefault() */ public function getMapTypeId() { - return ($this->helperData->getMapConfig('map_type')) ?: 'roadmap'; + return $this->helperData->getMapConfig('map_type') ?: 'roadmap'; } /** diff --git a/Helper/Data.php b/Helper/Data.php index 096dffc..68d22bc 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -22,6 +22,7 @@ namespace Mageplaza\GoogleMaps\Helper; use Magento\Framework\App\Helper\Context; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\ObjectManagerInterface; use Magento\Store\Model\StoreManagerInterface; use Mageplaza\Core\Helper\AbstractData; @@ -60,9 +61,8 @@ public function __construct( StoreManagerInterface $storeManager, Image $helperImage, MapStyle $mapStyleData - ) - { - $this->_helperImage = $helperImage; + ) { + $this->_helperImage = $helperImage; $this->_mapStyleData = $mapStyleData; parent::__construct($context, $objectManager, $storeManager); @@ -86,15 +86,17 @@ public function getMapConfig($code, $storeId = null) /** * Get custom marker icon Url * - * @return bool|string + * @return string + * @throws NoSuchEntityException */ public function getMarkerUrl() { if ($this->getMapConfig('marker_icon')) { - return $this->_helperImage->getBaseMediaUrl() . '/' . $this->_helperImage->getMediaPath($this->getMapConfig('marker_icon'), 'marker_icon'); - } else { - return ''; + return $this->_helperImage->getBaseMediaUrl() . '/' + . $this->_helperImage->getMediaPath($this->getMapConfig('marker_icon'), 'marker_icon'); } + + return ''; } /** @@ -106,4 +108,4 @@ public function getMapTheme($styleName) { return $this->_mapStyleData->getMapData($styleName); } -} \ No newline at end of file +} diff --git a/Model/Config/Source/System/MapStyle.php b/Model/Config/Source/System/MapStyle.php index 6fcd1fb..6630276 100644 --- a/Model/Config/Source/System/MapStyle.php +++ b/Model/Config/Source/System/MapStyle.php @@ -39,7 +39,7 @@ class MapStyle implements ArrayInterface const STYLE_LIGHT_GREY = 'light-grey'; const STYLE_MID_NIGHT = 'mid-night'; const STYLE_NATURE_COLOR = 'nature-color'; - CONST MAP_DATA = [ + const MAP_DATA = [ self::STYLE_DEFAULT => '[]', self::STYLE_BLUE_ESSENCE => '[{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#e0efef"}]},{"featureType":"poi","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"hue":"#1900ff"},{"color":"#c0e8e8"}]},{"featureType":"road","elementType":"geometry","stylers":[{"lightness":100},{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"visibility":"on"},{"lightness":700}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#7dcdcd"}]}]', self::STYLE_DARK_GREEN => '[{"featureType":"all","elementType":"all","stylers":[{"visibility":"on"}]},{"featureType":"all","elementType":"labels","stylers":[{"visibility":"off"},{"saturation":"-100"}]},{"featureType":"all","elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#000000"},{"lightness":40},{"visibility":"off"}]},{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"visibility":"off"},{"color":"#000000"},{"lightness":16}]},{"featureType":"all","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":17},{"weight":1.2}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"landscape","elementType":"geometry.fill","stylers":[{"color":"#4d6059"}]},{"featureType":"landscape","elementType":"geometry.stroke","stylers":[{"color":"#4d6059"}]},{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"color":"#4d6059"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"lightness":21}]},{"featureType":"poi","elementType":"geometry.fill","stylers":[{"color":"#4d6059"}]},{"featureType":"poi","elementType":"geometry.stroke","stylers":[{"color":"#4d6059"}]},{"featureType":"road","elementType":"geometry","stylers":[{"visibility":"on"},{"color":"#7f8d89"}]},{"featureType":"road","elementType":"geometry.fill","stylers":[{"color":"#7f8d89"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#7f8d89"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#7f8d89"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":18}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#7f8d89"}]},{"featureType":"road.arterial","elementType":"geometry.stroke","stylers":[{"color":"#7f8d89"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":16}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"color":"#7f8d89"}]},{"featureType":"road.local","elementType":"geometry.stroke","stylers":[{"color":"#7f8d89"}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":19}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#2b3638"},{"visibility":"on"}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#2b3638"},{"lightness":17}]},{"featureType":"water","elementType":"geometry.fill","stylers":[{"color":"#24282b"}]},{"featureType":"water","elementType":"geometry.stroke","stylers":[{"color":"#24282b"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels.text","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels.text.fill","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels.text.stroke","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels.icon","stylers":[{"visibility":"off"}]}]', diff --git a/USER-GUIDE.md b/USER-GUIDE.md index 2756e22..e034797 100644 --- a/USER-GUIDE.md +++ b/USER-GUIDE.md @@ -4,7 +4,7 @@ - User Guide: https://docs.mageplaza.com/google-maps/ - Product page: https://www.mageplaza.com/magento-2-google-maps/ - FAQs: https://www.mageplaza.com/faqs/ -- Get Support: https://mageplaza.freshdesk.com/ or support@mageplaza.com +- Get Support: https://www.mageplaza.com/contact.html or support@mageplaza.com - Changelog: https://www.mageplaza.com/releases/google-maps/ - License agreement: https://www.mageplaza.com/LICENSE.txt diff --git a/UserGuide.pdf b/UserGuide.pdf index f3a08ac..f9ccdf6 100644 Binary files a/UserGuide.pdf and b/UserGuide.pdf differ diff --git a/composer.json b/composer.json index 8e0d4d0..de5cdcf 100644 --- a/composer.json +++ b/composer.json @@ -2,10 +2,10 @@ "name": "mageplaza/module-google-maps", "description": "Magento 2 Google Maps Extension", "require": { - "mageplaza/module-core": "^1.4.0" + "mageplaza/module-core": "^1.4.5" }, "type": "magento2-module", - "version": "1.0.1", + "version": "1.0.2", "license": "proprietary", "authors": [ { diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 8a56437..3de9939 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -82,6 +82,7 @@ + validate-zero-or-greater 1 diff --git a/etc/widget.xml b/etc/widget.xml index fd79289..8cd7c5b 100644 --- a/etc/widget.xml +++ b/etc/widget.xml @@ -22,14 +22,14 @@ --> - - Mageplaza Google Maps Widget + + Mageplaza Google Maps Widget - + diff --git a/i18n/en_US.csv b/i18n/en_US.csv index 6a46a8b..708a8bf 100644 --- a/i18n/en_US.csv +++ b/i18n/en_US.csv @@ -49,7 +49,3 @@ Address,Address "GPS Coordinates","GPS Coordinates" Latitude,Latitude Longitude,Longitude -"Mageplaza Google Maps","Mageplaza Google Maps" -"Mageplaza Google Maps Widget","Mageplaza Google Maps Widget" -Template,Template -"Google Map Template","Google Map Template" diff --git a/registration.php b/registration.php index c98264e..d3c5a5a 100644 --- a/registration.php +++ b/registration.php @@ -19,8 +19,10 @@ * @license https://www.mageplaza.com/LICENSE.txt */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, +use Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register( + ComponentRegistrar::MODULE, 'Mageplaza_GoogleMaps', __DIR__ ); diff --git a/view/adminhtml/templates/system/config/coordinate.phtml b/view/adminhtml/templates/system/config/coordinate.phtml index 872d810..d887aef 100644 --- a/view/adminhtml/templates/system/config/coordinate.phtml +++ b/view/adminhtml/templates/system/config/coordinate.phtml @@ -25,15 +25,15 @@ $address = $block->helperData->getMapConfig('location_setting/address'); $btnId = $block->getElement()->getId(); ?> - + -
@@ -42,9 +42,9 @@ $btnId = $block->getElement()->getId(); require([ 'jquery', 'mage/translate', - "https://maps.googleapis.com/maps/api/js?key=" + "https://maps.googleapis.com/maps/api/js?key=" ], function ($, $t) { - var buttonCoordinate = $('#_button'); + var buttonCoordinate = $('#_button'); var message = $('#coordinate-button-value .mpmessage'); var addressEl = $('input#mpgooglemaps_map_setting_location_setting_address'); buttonCoordinate.on('click', function () { @@ -53,7 +53,7 @@ $btnId = $block->getElement()->getId(); type: 'GET', data: { "address": addressEl.val(), - "key": '' + "key": '' }, beforeSend: function () { buttonCoordinate.text($t('Loading...')); diff --git a/view/frontend/templates/map.phtml b/view/frontend/templates/map.phtml index 7b245c5..ec61f95 100644 --- a/view/frontend/templates/map.phtml +++ b/view/frontend/templates/map.phtml @@ -21,23 +21,23 @@ /** @var \Mageplaza\GoogleMaps\Block\Map $block */ ?> -getProtocol() == Mageplaza\GoogleMaps\Model\Config\Source\System\Protocol::API): ?> +getProtocol() == Mageplaza\GoogleMaps\Model\Config\Source\System\Protocol::API) : ?>
-
- +
- getEmbedCode(); ?> + getEmbedCode() ?>
- \ No newline at end of file + diff --git a/view/frontend/templates/map/position.phtml b/view/frontend/templates/map/position.phtml index 4a834d9..73f61d0 100644 --- a/view/frontend/templates/map/position.phtml +++ b/view/frontend/templates/map/position.phtml @@ -21,8 +21,8 @@ /** @var \Mageplaza\GoogleMaps\Helper\Data $helperData */ /** @var \Magento\Framework\View\Element\Template $block */ -$helperData = $this->helper('Mageplaza\GoogleMaps\Helper\Data'); +$helperData = $this->helper(\Mageplaza\GoogleMaps\Helper\Data::class); $position = $helperData->getConfigGeneral('position'); -if ($helperData->getConfigGeneral('contact_page') && $position == $block->getData('position')): - echo $block->getLayout()->createBlock('Mageplaza\GoogleMaps\Block\Map')->toHtml(); -endif; +if ($helperData->getConfigGeneral('contact_page') && $position == $block->getData('position')) : ?> + getLayout()->createBlock(\Mageplaza\GoogleMaps\Block\Map::class)->toHtml() ?> +