You are here

public function MarkerInfoBubble::alterMap in Geolocation Field 8.3

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

File

modules/geolocation_google_maps/src/Plugin/geolocation/MapFeature/MarkerInfoBubble.php, line 158

Class

MarkerInfoBubble
Provides marker infobubble.

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'], [
    'library' => [
      'geolocation_google_maps/mapfeature.' . $this
        ->getPluginId(),
    ],
    'drupalSettings' => [
      'geolocation' => [
        'maps' => [
          $render_array['#id'] => [
            $this
              ->getPluginId() => [
              'enable' => TRUE,
              'closeButton' => $feature_settings['close_button'],
              'closeOther' => $feature_settings['close_other'],
              'closeButtonSrc' => $feature_settings['close_button_src'],
              'shadowStyle' => $feature_settings['shadow_style'],
              'padding' => $feature_settings['padding'],
              'borderRadius' => $feature_settings['border_radius'],
              'borderWidth' => $feature_settings['border_width'],
              'borderColor' => $feature_settings['border_color'],
              'backgroundColor' => $feature_settings['background_color'],
              'minWidth' => $feature_settings['min_width'],
              'maxWidth' => $feature_settings['max_width'],
              'minHeight' => $feature_settings['min_height'],
              'maxHeight' => $feature_settings['max_height'],
              'arrowStyle' => $feature_settings['arrow_style'],
              'arrowPosition' => $feature_settings['arrow_position'],
              'arrowSize' => $feature_settings['arrow_size'],
            ],
          ],
        ],
      ],
    ],
  ]);
  return $render_array;
}