You are here

public function Leaflet::alterCommonMap in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 modules/geolocation_leaflet/src/Plugin/geolocation/MapProvider/Leaflet.php \Drupal\geolocation_leaflet\Plugin\geolocation\MapProvider\Leaflet::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_leaflet/src/Plugin/geolocation/MapProvider/Leaflet.php, line 546

Class

Leaflet
Provides Leaflet maps.

Namespace

Drupal\geolocation_leaflet\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_leaflet/commonmap.leaflet',
    ],
  ]);
  return $render_array;
}