You are here

public function LeafletControlGeocoder::alterMap in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletControlGeocoder.php \Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature\LeafletControlGeocoder::alterMap()

Alter render array.

Parameters

array $render_array: Render array.

array $feature_settings: The current feature settings.

array $context: Context like field formatter, field widget or view.

Return value

array Render array.

Overrides ControlCustomElementBase::alterMap

File

modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletControlGeocoder.php, line 141

Class

LeafletControlGeocoder
Provides Geocoder control element.

Namespace

Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature

Code

public function alterMap(array $render_array, array $feature_settings, array $context = []) {
  $render_array = parent::alterMap($render_array, $feature_settings, $context);
  $feature_settings = $this
    ->getSettings($feature_settings);

  /** @var \Drupal\geolocation\GeocoderInterface $geocoder_plugin */
  $geocoder_plugin = $this->geocoderManager
    ->getGeocoder($feature_settings['geocoder'], $feature_settings['settings']);
  $geocoder_plugin
    ->formAttachGeocoder($render_array['#controls'][$this->pluginId], $render_array['#id']);
  return $render_array;
}