public function Photon::formAttachGeocoder in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 modules/geolocation_leaflet/src/Plugin/geolocation/Geocoder/Photon.php \Drupal\geolocation_leaflet\Plugin\geolocation\Geocoder\Photon::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 GeocoderBase::formAttachGeocoder
File
- modules/
geolocation_leaflet/ src/ Plugin/ geolocation/ Geocoder/ Photon.php, line 92
Class
- Photon
- Provides the Photon.
Namespace
Drupal\geolocation_leaflet\Plugin\geolocation\GeocoderCode
public function formAttachGeocoder(array &$render_array, $element_name) {
parent::formAttachGeocoder($render_array, $element_name);
$settings = $this
->getSettings();
$render_array['#attached'] = BubbleableMetadata::mergeAttachments(empty($render_array['#attached']) ? [] : $render_array['#attached'], [
'library' => [
'geolocation_leaflet/geocoder.photon',
],
'drupalSettings' => [
'geolocation' => [
'geocoder' => [
$this
->getPluginId() => [
'autocompleteMinLength' => empty($this->configuration['autocomplete_min_length']) ? 1 : (int) $this->configuration['autocomplete_min_length'],
'locationPriority' => [
'lat' => $settings['location_priority']['lat'],
'lon' => $settings['location_priority']['lng'],
],
'removeDuplicates' => $settings['remove_duplicates'],
],
],
],
],
]);
}