You are here

public function ControlGoogleMapType::alterMap in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_google_maps/src/Plugin/geolocation/MapFeature/ControlGoogleMapType.php \Drupal\geolocation_google_maps\Plugin\geolocation\MapFeature\ControlGoogleMapType::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 ControlGoogleElementBase::alterMap

File

modules/geolocation_google_maps/src/Plugin/geolocation/MapFeature/ControlGoogleMapType.php, line 58

Class

ControlGoogleMapType
Provides MapType control element.

Namespace

Drupal\geolocation_google_maps\Plugin\geolocation\MapFeature

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'], [
    'drupalSettings' => [
      'geolocation' => [
        'maps' => [
          $render_array['#id'] => [
            $this
              ->getPluginId() => [
              'style' => $feature_settings['style'],
            ],
          ],
        ],
      ],
    ],
  ]);
  return $render_array;
}