You are here

function leaflet_more_maps_leaflet_map_info in Leaflet More Maps 2.1.x

Same name and namespace in other branches
  1. 8 leaflet_more_maps.module \leaflet_more_maps_leaflet_map_info()

Implements hook_leaflet_map_info().

All maps show at lat=31, long=-89, zoom=4

Return value

array of map info (includes provider URL, attribution, map features)

File

./leaflet_more_maps.module, line 20

Code

function leaflet_more_maps_leaflet_map_info() {
  $default_settings = [
    'attributionControl' => TRUE,
    'closePopupOnClick' => TRUE,
    'doubleClickZoom' => TRUE,
    'dragging' => TRUE,
    'fadeAnimation' => TRUE,
    'layerControl' => FALSE,
    'maxZoom' => 18,
    'minZoom' => 0,
    'scrollWheelZoom' => TRUE,
    'touchZoom' => TRUE,
    'trackResize' => TRUE,
    // Don't specify zoom, if you want to use Auto-box.
    // 'zoom'            =>  2,
    'zoomAnimation' => TRUE,
    'zoomControl' => TRUE,
  ];
  $map_info = [];
  _leaflet_more_maps_assemble_default_map_info($map_info, $default_settings);
  $custom_maps = \Drupal::config('leaflet_more_maps.settings')
    ->get('leaflet_more_maps_custom_maps') ?? [];
  foreach ($custom_maps as $custom_map) {
    _leaflet_more_maps_assemble_custom_map_info($custom_map['map-key'], $custom_map['layer-keys'], $map_info, $default_settings, $custom_map['reverse-order']);
  }
  return $map_info;
}