You are here

function leaflet_leaflet_map_info in Leaflet 7

Same name and namespace in other branches
  1. 8 leaflet.module \leaflet_leaflet_map_info()
  2. 2.1.x leaflet.module \leaflet_leaflet_map_info()
  3. 2.0.x leaflet.module \leaflet_leaflet_map_info()

Implements hook_leaflet_map_info().

Return a default map for the module.

File

./leaflet.module, line 224

Code

function leaflet_leaflet_map_info() {
  return array(
    'OSM Mapnik' => array(
      'label' => 'OSM Mapnik',
      'description' => t('Leaflet default map.'),
      // 'center' is used when map contains no features, or every time the map
      // is loaded if "force" is TRUE. Otherwise, the map will center itself
      // intelligently based on the features in the map.
      // RdB: bad things happen when 'center' is specified and Leaflet
      // MarkerCluster is used, see https://drupal.org/node/2144935
      // Also, a hard-coded center is not a great idea.

      //'center' => array(

      //  'lat' => 45.526513,
      //  'lon' => -122.674833,
      //  'force' => FALSE,

      //),
      'settings' => array(
        // Setting "zoom" forces a zoom level on every map load.

        //'zoom' => 17,

        // The "zoomDefault" is only used when no features are present.
        'zoomDefault' => 10,
        'minZoom' => 0,
        'maxZoom' => 18,
        'dragging' => TRUE,
        'touchZoom' => TRUE,
        'scrollWheelZoom' => TRUE,
        'doubleClickZoom' => TRUE,
        'zoomControl' => TRUE,
        'attributionControl' => TRUE,
        'trackResize' => TRUE,
        'fadeAnimation' => TRUE,
        'zoomAnimation' => TRUE,
        'closePopupOnClick' => TRUE,
      ),
      'layers' => array(
        'earth' => array(
          'urlTemplate' => '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
          'options' => array(
            'attribution' => '<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap </a> contributors',
          ),
        ),
      ),
    ),
  );
}