public function GoogleGeocodingAPI::formAttachGeocoder in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 modules/geolocation_google_maps/src/Plugin/geolocation/Geocoder/GoogleGeocodingAPI.php \Drupal\geolocation_google_maps\Plugin\geolocation\Geocoder\GoogleGeocodingAPI::formAttachGeocoder()
Attach geocoding logic to input element.
Parameters
array $render_array: Form containing the input element.
string $element_name: Name of the input element.
Return value
array|null Updated form element or NULL.
Overrides GoogleGeocoderBase::formAttachGeocoder
File
- modules/
geolocation_google_maps/ src/ Plugin/ geolocation/ Geocoder/ GoogleGeocodingAPI.php, line 29
Class
- GoogleGeocodingAPI
- Provides the Google Geocoding API.
Namespace
Drupal\geolocation_google_maps\Plugin\geolocation\GeocoderCode
public function formAttachGeocoder(array &$render_array, $element_name) {
parent::formAttachGeocoder($render_array, $element_name);
$config = \Drupal::config('geolocation_google_maps.settings');
$render_array['#attached'] = BubbleableMetadata::mergeAttachments($render_array['#attached'], [
'library' => [
'geolocation_google_maps/geocoder.googlegeocodingapi',
],
]);
if (!empty($config
->get('google_map_custom_url_parameters')['region'])) {
$render_array['#attached']['drupalSettings']['geolocation']['geocoder'][$this
->getPluginId()]['region'] = $config
->get('google_map_custom_url_parameters')['region'];
}
}