public function GoogleMapsDisplayTrait::getGoogleMapsApiParameters in Geolocation Field 8
Return all module and custom defined parameters.
Return value
array Parameters
1 call to GoogleMapsDisplayTrait::getGoogleMapsApiParameters()
- GoogleMapsDisplayTrait::getGoogleMapsApiUrl in src/
GoogleMapsDisplayTrait.php - Return the fully build URL to load Google Maps API.
File
- src/
GoogleMapsDisplayTrait.php, line 70
Class
- GoogleMapsDisplayTrait
- Class GoogleMapsDisplayTrait.
Namespace
Drupal\geolocationCode
public function getGoogleMapsApiParameters() {
$config = \Drupal::config('geolocation.settings');
$geolocation_parameters = [
'callback' => 'Drupal.geolocation.googleCallback',
'key' => $config
->get('google_map_api_key'),
];
$module_parameters = \Drupal::moduleHandler()
->invokeAll('geolocation_google_maps_parameters') ?: [];
$custom_parameters = $config
->get('google_map_custom_url_parameters') ?: [];
// Set the map language to site language if desired and possible.
if ($config
->get('use_current_language') && \Drupal::moduleHandler()
->moduleExists('language')) {
$custom_parameters['language'] = \Drupal::languageManager()
->getCurrentLanguage()
->getId();
}
$parameters = array_replace_recursive($custom_parameters, $module_parameters, $geolocation_parameters);
if (!empty($parameters['client'])) {
unset($parameters['key']);
}
else {
unset($parameters['channel']);
}
return $parameters;
}