You are here

public function MapFeatureFrontendBase::alterMap in Geolocation Field 8.3

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 MapFeatureBase::alterMap

1 call to MapFeatureFrontendBase::alterMap()
MarkerZoomByAnchor::alterMap in modules/geolocation_google_maps/src/Plugin/geolocation/MapFeature/MarkerZoomByAnchor.php
Alter render array.
1 method overrides MapFeatureFrontendBase::alterMap()
MarkerZoomByAnchor::alterMap in modules/geolocation_google_maps/src/Plugin/geolocation/MapFeature/MarkerZoomByAnchor.php
Alter render array.

File

src/MapFeatureFrontendBase.php, line 17

Class

MapFeatureFrontendBase
Class MapFeatureFrontendBase.

Namespace

Drupal\geolocation

Code

public function alterMap(array $render_array, array $feature_settings, array $context = []) {
  $render_array = parent::alterMap($render_array, $feature_settings, $context);
  $render_array['#attached'] = BubbleableMetadata::mergeAttachments(empty($render_array['#attached']) ? [] : $render_array['#attached'], [
    'library' => [
      $this
        ->getPluginDefinition()['provider'] . '/mapfeature.' . $this
        ->getPluginId(),
    ],
    'drupalSettings' => [
      'geolocation' => [
        'maps' => [
          $render_array['#id'] => [
            $this
              ->getPluginId() => [
              'enable' => TRUE,
            ],
          ],
        ],
      ],
    ],
  ]);
  return $render_array;
}