You are here

public function MapRenderEvent::addSettings in farmOS 2.x

Add settings to the map.

These settings will be added to drupalSettings.farm_map.

Parameters

array $settings: The settings to be added.

1 call to MapRenderEvent::addSettings()
MapRenderEvent::addBehavior in modules/core/map/src/Event/MapRenderEvent.php
Add behavior to the map.

File

modules/core/map/src/Event/MapRenderEvent.php, line 100

Class

MapRenderEvent
An event that is dispatched before rendering a map on the page.

Namespace

Drupal\farm_map\Event

Code

public function addSettings(array $settings) {
  $existing = [];
  if (!empty($this->element['#attached']['drupalSettings']['farm_map'])) {
    $existing = $this->element['#attached']['drupalSettings']['farm_map'];
  }
  $this->element['#attached']['drupalSettings']['farm_map'] = array_replace_recursive($existing, $settings);
}