You are here

public function LeafletControlAttribution::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 ControlElementBase::alterMap

File

modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletControlAttribution.php, line 50

Class

LeafletControlAttribution
Provides Attribution control element.

Namespace

Drupal\geolocation_leaflet\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() => [
              'position' => $feature_settings['position'],
              'prefix' => $feature_settings['prefix'],
            ],
          ],
        ],
      ],
    ],
  ]);
  return $render_array;
}