From 5de1d9a351ab90bcb88134b46f03f09566cb49bb Mon Sep 17 00:00:00 2001 From: Tam Date: Thu, 4 Apr 2024 15:32:12 +0100 Subject: [PATCH] 4.0.5 ### Fixed - Fix referred on Mapbox geo requests (Fixes #338, via @maxdmyers) - Fix type errors in front-end usage (Fixes #379, via @samhibberd) - Fix error when normalizing invalid location (Fixes #368, #380, via @Decyphr) - Fix intermittent issues w/ Google Maps API loading (Fixes #294, via @davidwebca) - Allow nullable zoom value (Fixes #381) - Pass site language to embedded Google map (Fixes #373) - Support casting map to string (Fixes #362) - Remove reference to MaxMind Lite from docs (Fixes #358) --- CHANGELOG.md | 11 +++++++++++ docs/getting-started/config.md | 5 +---- src/models/BaseLocation.php | 7 ++++++- src/models/Map.php | 2 +- src/services/EmbedService.php | 1 + 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 269d69c..68dc101 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## 4.0.5 - 2024-04-04 +### Fixed +- Fix referred on Mapbox geo requests (Fixes #338, via @maxdmyers) +- Fix type errors in front-end usage (Fixes #379, via @samhibberd) +- Fix error when normalizing invalid location (Fixes #368, #380, via @Decyphr) +- Fix intermittent issues w/ Google Maps API loading (Fixes #294, via @davidwebca) +- Allow nullable zoom value (Fixes #381) +- Pass site language to embedded Google map (Fixes #373) +- Support casting map to string (Fixes #362) +- Remove reference to MaxMind Lite from docs (Fixes #358) + ## 4.0.4 - 2023-06-26 ### Fixed - Update settings autosuggest input (Fixes #374) diff --git a/docs/getting-started/config.md b/docs/getting-started/config.md index 7b7fd62..a9750b4 100644 --- a/docs/getting-started/config.md +++ b/docs/getting-started/config.md @@ -44,9 +44,6 @@ needed! ##### [ipstack](https://ipstack.com/product) ipstack offer free and paid-for versions of their API. -##### MaxMind Lite -No token required - ##### [MaxMind](https://www.maxmind.com/en/geoip2-precision-services) MaxMind offer free lookup database that must be stored locally, and a more accurate paid-for version of their API. @@ -197,7 +194,7 @@ constants. use ether\simplemap\services\GeoLocationService; return [ - 'geoLocationService' => GeoLocationService::MaxMindLite, + 'geoLocationService' => GeoLocationService::MaxMind, ]; ``` diff --git a/src/models/BaseLocation.php b/src/models/BaseLocation.php index e1bad69..1513830 100644 --- a/src/models/BaseLocation.php +++ b/src/models/BaseLocation.php @@ -46,7 +46,7 @@ abstract class BaseLocation extends Model public function __construct ($config = []) { Typecast::properties(static::class, $config); - + parent::__construct($config); if ($this->address === null) @@ -115,4 +115,9 @@ public function address (array $exclude = [], string $glue = '
'): Markup return new Markup(implode($glue, $addr), 'utf8'); } + public function __toString(): string + { + return (string) $this->address([], ', '); + } + } diff --git a/src/models/Map.php b/src/models/Map.php index fcb62b0..3ee5294 100644 --- a/src/models/Map.php +++ b/src/models/Map.php @@ -40,7 +40,7 @@ class Map extends BaseLocation public ?int $fieldId = null; /** @var int */ - public int $zoom = 15; + public ?int $zoom = 15; /** @var int|float|null */ public int|null|float $distance = null; diff --git a/src/services/EmbedService.php b/src/services/EmbedService.php index 473f359..682fa71 100644 --- a/src/services/EmbedService.php +++ b/src/services/EmbedService.php @@ -145,6 +145,7 @@ private function _embedGoogle (EmbedOptions $options, Settings $settings): strin $params = http_build_query([ 'key' => $settings->getMapToken(), 'callback' => $callbackName, + 'language' => Craft::$app->getSites()->getCurrentSite()->language, ]); $js = <<