Skip to content
Snippets Groups Projects
Commit 3f3925a4 authored by Jeroen Tubex's avatar Jeroen Tubex Committed by Italo Mairo
Browse files

Issue #3364857 by JeroenT: Add default country for Geopunt provider

parent cba4aa0f
No related branches found
No related tags found
No related merge requests found
...@@ -72,3 +72,17 @@ function geocoder_geocoder_provider_info_alter(array &$plugins): void { ...@@ -72,3 +72,17 @@ function geocoder_geocoder_provider_info_alter(array &$plugins): void {
return empty($plugin['handler']) || class_exists($plugin['handler']); return empty($plugin['handler']) || class_exists($plugin['handler']);
}); });
} }
/**
* Implements hook_geocode_country_code_alter().
*
* Geopunt only works for Belgium, but doens't include the country in the API
* response, which may result in unexpected behaviour e.g. Reverse geocoding
* and saving the result in an address field, since a country is required for
* address field to work.
*/
function geocoder_geocode_country_code_alter(string &$country_code, array $geojson_array): void {
if (isset($geojson_array['properties']['providedBy']) && $geojson_array['properties']['providedBy'] === 'geopunt') {
$country_code = 'BE';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment