You are here

public function GoogleMaps::alterCommonMap in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_google_maps/src/Plugin/geolocation/MapProvider/GoogleMaps.php \Drupal\geolocation_google_maps\Plugin\geolocation\MapProvider\GoogleMaps::alterCommonMap()

Alter common map build array.

Parameters

array $render_array: Render array.

array $map_settings: The current map settings.

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

Return value

array Render attachments.

Overrides MapProviderBase::alterCommonMap

File

modules/geolocation_google_maps/src/Plugin/geolocation/MapProvider/GoogleMaps.php, line 241

Class

GoogleMaps
Provides Google Maps.

Namespace

Drupal\geolocation_google_maps\Plugin\geolocation\MapProvider

Code

public function alterCommonMap(array $render_array, array $map_settings, array $context) {
  $render_array['#attached'] = BubbleableMetadata::mergeAttachments(empty($render_array['#attached']) ? [] : $render_array['#attached'], [
    'library' => [
      'geolocation_google_maps/commonmap.google',
    ],
  ]);
  return $render_array;
}