You are here

function getlocations_leaflet_map_settings_do in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_leaflet/getlocations_leaflet.module \getlocations_leaflet_map_settings_do()

Function

Return value

Returns

4 calls to getlocations_leaflet_map_settings_do()
getlocations_leaflet_entity_type_map in modules/getlocations_leaflet/getlocations_leaflet.module
Function
getlocations_leaflet_field_formatter_view in modules/getlocations_leaflet/getlocations_leaflet.module
Implements hook_field_formatter_view(). Build a renderable array for a field value.
template_preprocess_getlocations_leaflet_view_map in modules/getlocations_leaflet/views/getlocations_leaflet.views.inc
Preprocess function for getlocations_leaflet_view_map.tpl
theme_getlocations_leaflet_settings_form in modules/getlocations_leaflet/getlocations_leaflet.module
Function

File

modules/getlocations_leaflet/getlocations_leaflet.module, line 1253
getlocations_leaflet.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_leaflet_map_settings_do($map_settings, $defaults, $latlons, $mapid) {
  $map_settings['map_opts']['dragging'] = $defaults['dragging'] ? TRUE : FALSE;
  $map_settings['map_opts']['scrollWheelZoom'] = $defaults['scrollWheelZoom'] ? TRUE : FALSE;
  $map_settings['map_opts']['doubleClickZoom'] = $defaults['doubleClickZoom'] ? TRUE : FALSE;
  $map_settings['map_opts']['touchZoom'] = $defaults['touchZoom'] ? TRUE : FALSE;
  $map_settings['map_opts']['trackResize'] = $defaults['trackResize'] ? TRUE : FALSE;
  $map_settings['map_opts']['fadeAnimation'] = $defaults['fadeAnimation'] ? TRUE : FALSE;
  $map_settings['map_opts']['zoomAnimation'] = $defaults['zoomAnimation'] ? TRUE : FALSE;
  $map_settings['map_opts']['closePopupOnClick'] = $defaults['closePopupOnClick'] ? TRUE : FALSE;
  $map_settings['map_opts']['boxZoom'] = $defaults['boxZoom'] ? TRUE : FALSE;
  $map_settings['map_opts']['tap'] = $defaults['tap'] ? TRUE : FALSE;
  $map_settings['map_opts']['tapTolerance'] = $defaults['tapTolerance'];
  $map_settings['map_opts']['bounceAtZoomLimits'] = $defaults['bounceAtZoomLimits'] ? TRUE : FALSE;
  $getlocations_leaflet_plugins = getlocations_leaflet_plugins();
  if ($getlocations_leaflet_plugins['fullscreen_enable']) {
    $map_settings['map_settings']['fullscreen'] = $defaults['fullscreen'] ? TRUE : FALSE;
  }
  else {
    $map_settings['map_settings']['fullscreen'] = FALSE;
  }
  $map_settings['map_settings']['fullscreenposition'] = $defaults['fullscreenposition'];
  if ($getlocations_leaflet_plugins['graticule_enable']) {
    $map_settings['map_settings']['graticule'] = $defaults['graticule'] ? TRUE : FALSE;
    $map_settings['map_settings']['graticule_color'] = $defaults['graticule_color'];
    $map_settings['map_settings']['graticule_opacity'] = $defaults['graticule_opacity'];
    $map_settings['map_settings']['graticule_weight'] = $defaults['graticule_weight'];
    $map_settings['map_settings']['graticule_interval'] = $defaults['graticule_interval'];
    $map_settings['map_settings']['graticule_ov_label'] = $defaults['graticule_ov_label'];
    $map_settings['map_settings']['graticule_position'] = $defaults['graticule_position'];
    $map_settings['map_settings']['graticule_show'] = $defaults['graticule_show'];
    $map_settings['map_settings']['graticule_state'] = $defaults['graticule_state'];
  }
  else {
    $map_settings['map_settings']['graticule'] = FALSE;
  }
  if ($getlocations_leaflet_plugins['mouseposition_enable']) {
    $map_settings['map_settings']['mouseposition'] = $defaults['mouseposition'] ? TRUE : FALSE;
    $map_settings['map_settings']['mouseposition_position'] = $defaults['mouseposition_position'];
    $map_settings['map_settings']['mouseposition_display_dms'] = $defaults['mouseposition_display_dms'];
  }
  else {
    $map_settings['map_settings']['mouseposition'] = FALSE;
  }
  if ($getlocations_leaflet_plugins['minimap_enable']) {
    $map_settings['map_settings']['minimap'] = $defaults['minimap'] ? TRUE : FALSE;
  }
  else {
    $map_settings['map_settings']['minimap'] = FALSE;
  }

  // mapquest
  $mapquest_lic = variable_get('getlocations_mapquest_lic', array(
    'key' => '',
    'type' => 'l',
  ));
  $map_settings['map_settings']['mapquest_key'] = $mapquest_lic['key'];
  if ($getlocations_leaflet_plugins['geocoder_enable']) {
    $map_settings['map_settings']['geocoder'] = $defaults['geocoder'] ? TRUE : FALSE;
    $map_settings['map_settings']['geocoderposition'] = $defaults['geocoderposition'];
    $map_settings['map_settings']['geocodersrc'] = $defaults['geocodersrc'];
    $map_settings['map_settings']['geocodercollapsed'] = $defaults['geocodercollapsed'];
    $map_settings['map_settings']['geocoder_bing_key'] = $defaults['geocoder_bing_key'];
    $map_settings['map_settings']['geocoder_mapquest_key'] = $defaults['geocoder_mapquest_key'];
    $map_settings['map_settings']['geocoder_mapbox_key'] = $defaults['geocoder_mapbox_key'];
    $map_settings['map_settings']['geocoder_google_key'] = $defaults['geocoder_google_key'];
    $map_settings['map_settings']['geocoder_placeholder'] = $defaults['geocoder_placeholder'];
    $map_settings['map_settings']['geocoder_errormessage'] = $defaults['geocoder_errormessage'];
  }
  else {
    $map_settings['map_settings']['geocoder'] = FALSE;
  }

  // usermarker
  if ($getlocations_leaflet_plugins['usermarker_enable']) {
    $map_settings['map_settings']['usermarker'] = $defaults['usermarker'] ? TRUE : FALSE;
    $map_settings['map_settings']['usermarker_pulsing'] = $defaults['usermarker_pulsing'] ? TRUE : FALSE;
    $map_settings['map_settings']['usermarker_smallicon'] = $defaults['usermarker_smallicon'] ? TRUE : FALSE;
    $map_settings['map_settings']['usermarker_accuracy'] = $defaults['usermarker_accuracy'] ? TRUE : FALSE;
    $map_settings['map_settings']['usermarker_circle_stroke'] = $defaults['usermarker_circle_stroke'] ? TRUE : FALSE;
    $map_settings['map_settings']['usermarker_circle_strokecolor'] = $defaults['usermarker_circle_strokecolor'];
    $map_settings['map_settings']['usermarker_circle_strokeopacity'] = $defaults['usermarker_circle_strokeopacity'];
    $map_settings['map_settings']['usermarker_circle_strokeweight'] = $defaults['usermarker_circle_strokeweight'];
    $map_settings['map_settings']['usermarker_circle_fillcolor'] = $defaults['usermarker_circle_fillcolor'];
    $map_settings['map_settings']['usermarker_circle_fillopacity'] = $defaults['usermarker_circle_fillopacity'];
    $map_settings['map_settings']['usermarker_button_label'] = $defaults['usermarker_button_label'];
  }
  else {
    $map_settings['map_settings']['usermarker'] = FALSE;
  }

  // bouncemarker
  if ($getlocations_leaflet_plugins['bouncemarker_enable']) {
    $map_settings['map_settings']['bouncemarker'] = $defaults['bouncemarker'] ? TRUE : FALSE;
    $map_settings['map_settings']['bouncemarker_duration'] = $defaults['bouncemarker_duration'];
    $map_settings['map_settings']['bouncemarker_height'] = $defaults['bouncemarker_height'];
  }
  if ($getlocations_leaflet_plugins['markercluster_enable']) {
    $map_settings['map_settings']['markercluster'] = $defaults['markercluster'] ? TRUE : FALSE;
  }
  else {
    $map_settings['map_settings']['markercluster'] = FALSE;
  }
  if ($getlocations_leaflet_plugins['magnifyingglass_enable']) {
    $map_settings['map_settings']['magnifyingglass'] = $defaults['magnifyingglass'] ? TRUE : FALSE;
    $map_settings['map_settings']['magnifyingglasscontrolposition'] = $defaults['magnifyingglasscontrolposition'];
    $map_settings['map_settings']['magnifyingglassradius'] = $defaults['magnifyingglassradius'];
    $map_settings['map_settings']['magnifyingglasszoomoffset'] = $defaults['magnifyingglasszoomoffset'];

    #$map_settings['map_settings']['magnifyingglasstitle'] = $defaults['magnifyingglasstitle'];
  }
  else {
    $map_settings['map_settings']['magnifyingglass'] = FALSE;
  }
  if ($getlocations_leaflet_plugins['terminator_enable']) {
    $map_settings['map_settings']['terminator'] = $defaults['terminator'] ? TRUE : FALSE;
    $map_settings['map_settings']['terminator_strokecolor'] = $defaults['terminator_strokecolor'];
    $map_settings['map_settings']['terminator_strokeopacity'] = $defaults['terminator_strokeopacity'];
    $map_settings['map_settings']['terminator_strokeweight'] = $defaults['terminator_strokeweight'];
    $map_settings['map_settings']['terminator_fillcolor'] = $defaults['terminator_fillcolor'];
    $map_settings['map_settings']['terminator_fillopacity'] = $defaults['terminator_fillopacity'];
    $map_settings['map_settings']['terminator_position'] = $defaults['terminator_position'];
    $map_settings['map_settings']['terminator_show'] = $defaults['terminator_show'];
    $map_settings['map_settings']['terminator_state'] = $defaults['terminator_state'];
    $map_settings['map_settings']['terminator_label'] = $defaults['terminator_label'];
  }
  else {
    $map_settings['map_settings']['terminator'] = FALSE;
  }

  // mapquest
  $map_settings['map_settings']['mapquest_traffic_enable'] = $getlocations_leaflet_plugins['mapquest_traffic_enable'] ? 1 : 0;
  $map_settings['map_settings']['mapquest_traffic_flow'] = $defaults['mapquest_traffic_flow'] ? 1 : 0;
  $map_settings['map_settings']['mapquest_traffic_flow_on'] = $defaults['mapquest_traffic_flow_on'] ? 1 : 0;
  $map_settings['map_settings']['mapquest_traffic_incident'] = $defaults['mapquest_traffic_incident'] ? 1 : 0;
  $map_settings['map_settings']['mapquest_traffic_incident_on'] = $defaults['mapquest_traffic_incident_on'] ? 1 : 0;
  $map_settings['map_settings']['mapquest_routing_enable'] = $getlocations_leaflet_plugins['mapquest_routing_enable'] ? 1 : 0;
  $map_settings['map_settings']['mapquest_geocoder_enable'] = $getlocations_leaflet_plugins['mapquest_geocoder_enable'] ? 1 : 0;
  $map_settings['map_settings']['mapquest_maps_enable'] = $getlocations_leaflet_plugins['mapquest_maps_enable'] ? 1 : 0;
  $map_settings['map_settings']['mapquest_maps_default'] = $defaults['mapquest_maps_default'];
  $map_settings['map_settings']['mapquest_maps_maplayer'] = $defaults['mapquest_maps_maplayer'];
  $map_settings['map_settings']['mapquest_maps_satellitelayer'] = $defaults['mapquest_maps_satellitelayer'];
  $map_settings['map_settings']['mapquest_maps_hybridlayer'] = $defaults['mapquest_maps_hybridlayer'];
  $map_settings['map_settings']['mapquest_maps_use'] = $defaults['mapquest_maps_use'];
  if ($getlocations_leaflet_plugins['pancontrol_enable']) {
    $map_settings['map_settings']['leaflet_pancontrol'] = $defaults['pancontrol'] ? TRUE : FALSE;
  }
  else {
    $map_settings['map_settings']['leaflet_pancontrol'] = FALSE;
  }
  $map_settings['map_settings']['pancontrolposition'] = $defaults['pancontrolposition'];
  $map_settings['map_settings']['awesome'] = $getlocations_leaflet_plugins['awesome_enable'] ? TRUE : FALSE;
  $map_settings['map_settings']['markerclusteroptions'] = '';
  if (file_exists(GETLOCATIONS_LEAFLET_PATH . '/plugins/markercluster/markerclusteroptions.inc')) {
    module_load_include('inc', 'getlocations_leaflet', 'plugins/markercluster/markerclusteroptions');
    if (function_exists('getlocations_leaflet_get_markerclusteroptions')) {
      $map_settings['map_settings']['markerclusteroptions'] = getlocations_leaflet_get_markerclusteroptions();
    }
  }

  // Zoom
  if ($defaults['zoomControl']) {
    $map_settings['map_opts']['zoomControl'] = FALSE;
    $map_settings['map_settings']['zoomControl'] = TRUE;
  }
  else {
    $map_settings['map_opts']['zoomControl'] = FALSE;
    $map_settings['map_settings']['zoomControl'] = FALSE;
  }
  $map_settings['map_settings']['zoomcontrolposition'] = $defaults['zoomcontrolposition'];

  // zoomslider
  if ($getlocations_leaflet_plugins['zoomslider_enable']) {
    $map_settings['map_settings']['leaflet_zoomslider'] = $defaults['zoomslider'] ? TRUE : FALSE;

    // kill off zoomcontrol
    if ($defaults['zoomslider']) {
      $map_settings['map_settings']['zoomControl'] = FALSE;
      $map_settings['map_opts']['zoomControl'] = FALSE;
    }
  }
  else {
    $map_settings['map_settings']['leaflet_zoomslider'] = FALSE;
  }
  $map_settings['map_settings']['zoomsliderposition'] = $defaults['zoomsliderposition'];

  // Attribution
  if ($defaults['attributionControl'] && $defaults['attributioncontrolposition']) {
    $map_settings['map_opts']['attributionControl'] = FALSE;
    $map_settings['map_settings']['attributionControl'] = TRUE;
    $map_settings['map_settings']['attributioncontrolposition'] = $defaults['attributioncontrolposition'];
  }
  else {
    $map_settings['map_opts']['attributionControl'] = $defaults['attributionControl'] ? TRUE : FALSE;
    $map_settings['map_settings']['attributionControl'] = FALSE;
    $map_settings['map_settings']['attributioncontrolposition'] = '';
  }

  // Layer
  if ($defaults['layerControl'] && $defaults['layercontrolposition']) {
    $map_settings['map_opts']['layerControl'] = FALSE;
    $map_settings['map_settings']['layerControl'] = TRUE;
    $map_settings['map_settings']['layercontrolposition'] = $defaults['layercontrolposition'];
  }
  else {
    $map_settings['map_opts']['layerControl'] = FALSE;
    $map_settings['map_settings']['layerControl'] = $defaults['layerControl'] ? TRUE : FALSE;
    $map_settings['map_settings']['layercontrolposition'] = '';
  }

  // overlays
  $map_settings['map_settings']['layercontrol_mark_ov'] = $defaults['layercontrol_mark_ov'] ? TRUE : FALSE;
  $map_settings['map_settings']['layercontrol_mark_ov_label'] = $defaults['layercontrol_mark_ov_label'];
  $map_settings['map_settings']['layercontrol_circ_ov'] = $defaults['layercontrol_circ_ov'] ? TRUE : FALSE;
  $map_settings['map_settings']['layercontrol_circ_ov_label'] = $defaults['layercontrol_circ_ov_label'];
  $map_settings['map_settings']['layercontrol_polyl_ov'] = $defaults['layercontrol_polyl_ov'] ? TRUE : FALSE;
  $map_settings['map_settings']['layercontrol_polyl_ov_label'] = $defaults['layercontrol_polyl_ov_label'];
  $map_settings['map_settings']['layercontrol_polyg_ov'] = $defaults['layercontrol_polyg_ov'] ? TRUE : FALSE;
  $map_settings['map_settings']['layercontrol_polyg_ov_label'] = $defaults['layercontrol_polyg_ov_label'];
  $map_settings['map_settings']['layercontrol_rect_ov'] = $defaults['layercontrol_rect_ov'] ? TRUE : FALSE;
  $map_settings['map_settings']['layercontrol_rect_ov_label'] = $defaults['layercontrol_rect_ov_label'];

  // default map
  $ml = getlocations_leaflet_map_get_info('Getlocations OSM');
  $map_settings['map_settings']['default_layer_name'] = $defaults['default_baselayer'];
  $map_settings['map_settings']['default_layer_label'] = $ml['map_layers'][$defaults['default_baselayer']]['label'];

  // if only one has been selected
  if (isset($map_settings['map_layers']) && count($map_settings['map_layers']) == 1) {
    $map_keys = array_keys($map_settings['map_layers']);
    if ($map_settings['map_layers'][$map_keys[0]]['type'] == 'base') {
      $map_settings['map_settings']['default_layer_name'] = $map_keys[0];
      $map_settings['map_settings']['default_layer_label'] = $map_settings['map_layers'][$map_keys[0]]['label'];
    }
  }

  // Scale
  $map_settings['map_settings']['scaleControl'] = $defaults['scaleControl'] ? TRUE : FALSE;
  $map_settings['map_settings']['scalecontrolposition'] = $defaults['scalecontrolposition'];
  $map_settings['map_settings']['scalecontrolunits'] = $defaults['scalecontrolunits'];
  if ($defaults['minzoom_map'] > -1) {
    $map_settings['map_opts']['minZoom'] = $defaults['minzoom_map'];
  }
  if ($defaults['maxzoom_map'] > -1) {
    $map_settings['map_opts']['maxZoom'] = $defaults['maxzoom_map'];
  }
  $map_settings['map_settings']['show_maplinks'] = $defaults['show_maplinks'];
  $map_settings['map_settings']['show_maplinks_viewport'] = $defaults['show_maplinks_viewport'];
  $map_settings['map_settings']['show_search_distance'] = $defaults['show_search_distance'];
  $map_settings['map_settings']['views_search_marker_enable'] = $defaults['views_search_marker_enable'];
  $map_settings['map_settings']['views_search_marker'] = $defaults['views_search_marker'];
  $map_settings['map_settings']['views_search_marker_info'] = '';
  if ($defaults['views_search_marker']) {
    $map_settings['map_settings']['views_search_marker_info'] = getlocations_leaflet_get_marker($defaults['views_search_marker']);
  }
  $map_settings['map_settings']['views_search_marker_toggle'] = $defaults['views_search_marker_toggle'];
  $map_settings['map_settings']['views_search_marker_toggle_active'] = $defaults['views_search_marker_toggle_active'];
  $map_settings['map_settings']['views_search_radshape_enable'] = $defaults['views_search_radshape_enable'];
  $map_settings['map_settings']['views_search_radshape_strokecolor'] = $defaults['views_search_radshape_strokecolor'];
  $map_settings['map_settings']['views_search_radshape_strokeopacity'] = $defaults['views_search_radshape_strokeopacity'];
  $map_settings['map_settings']['views_search_radshape_strokeweight'] = $defaults['views_search_radshape_strokeweight'];
  $map_settings['map_settings']['views_search_radshape_fillcolor'] = $defaults['views_search_radshape_fillcolor'];
  $map_settings['map_settings']['views_search_radshape_fillopacity'] = $defaults['views_search_radshape_fillopacity'];
  $map_settings['map_settings']['views_search_radshape_toggle'] = $defaults['views_search_radshape_toggle'];
  $map_settings['map_settings']['views_search_radshape_toggle_active'] = $defaults['views_search_radshape_toggle_active'];
  $map_settings['map_settings']['views_search_center'] = $defaults['views_search_center'];
  $map_settings['map_settings']['geolocation_mobile_check'] = $defaults['geolocation_mobile_check'];

  // field group support;
  $map_settings['map_settings']['field_group_enable'] = module_exists('field_group') ? 1 : 0;

  // leaflet hash
  $map_settings['map_settings']['hashurl'] = $getlocations_leaflet_plugins['hash_enable'] ? $defaults['hashurl'] : 0;
  $getlocations_leaflet_paths = getlocations_leaflet_paths_get();

  // What3Words
  $what3words_lic = variable_get('getlocations_what3words_lic', array(
    'key' => '',
    'url' => 'http://api.what3words.com',
  ));
  if ($what3words_lic['key'] && $defaults['what3words_enable']) {
    $icon = getlocations_leaflet_get_marker($defaults['what3words_map_marker']);

    #$map_settings['map_settings']['what3words_key'] = $what3words_lic['key'];
    $map_settings['map_settings']['what3words_enable'] = $defaults['what3words_enable'];
    $map_settings['map_settings']['what3words_search'] = $defaults['what3words_search'];

    #$map_settings['map_settings']['what3words_map_marker']  = $defaults['what3words_map_marker'];
    $map_settings['map_settings']['what3words_map_marker'] = $icon;
    $map_settings['map_settings']['what3words_center'] = $defaults['what3words_center'];
    $map_settings['map_settings']['what3words_zoom'] = $defaults['what3words_zoom'];
    $map_settings['map_settings']['what3words_show'] = $defaults['what3words_show'];
    $map_settings['map_settings']['what3words_marker_show'] = $defaults['what3words_marker_show'];
    $map_settings['map_settings']['what3words_click'] = $defaults['what3words_click'];
    $map_settings['map_settings']['what3words_size'] = $defaults['what3words_size'];
    $map_settings['map_settings']['what3words_path'] = url($defaults['what3words_path']);
    drupal_add_js($getlocations_leaflet_paths['getlocations_leaflet_what3words_path']);
  }
  else {
    $map_settings['map_settings']['what3words_enable'] = 0;
  }

  // shapes
  // polygons
  if ($defaults['polygons_enable'] && !empty($defaults['polygons_coords'])) {
    $polygons = getlocations_get_polygon_settings($defaults);
    if ($polygons) {
      $polygon_settings = array(
        $mapid => $polygons,
      );
      drupal_add_js(array(
        'getlocations_leaflet_polygons' => $polygon_settings,
      ), 'setting');
      drupal_add_js($getlocations_leaflet_paths['getlocations_leaflet_polygons_path']);
    }
  }

  // rectangles
  if ($defaults['rectangles_enable'] && (!empty($defaults['rectangles_coords']) || $defaults['rectangles_apply'] && $defaults['rectangles_dist'])) {
    if ($defaults['rectangles_apply'] && $defaults['rectangles_dist']) {

      // get latlons and set coords
      $tmp = '';
      foreach ($latlons as $ll) {
        $lats = getlocations_earth_latitude_range($ll[0], $ll[1], $defaults['rectangles_dist']);
        $lngs = getlocations_earth_longitude_range($ll[0], $ll[1], $defaults['rectangles_dist']);
        $tmp .= $lats[0] . ',' . $lngs[0] . '|' . $lats[1] . ',' . $lngs[1] . "\n";
      }
      if ($tmp) {
        $defaults['rectangles_coords'] = $tmp;
      }
    }
    $rectangles = getlocations_get_rectangle_settings($defaults);
    if ($rectangles) {
      $rectangle_settings = array(
        $mapid => $rectangles,
      );
      drupal_add_js(array(
        'getlocations_leaflet_rectangles' => $rectangle_settings,
      ), 'setting');
      drupal_add_js($getlocations_leaflet_paths['getlocations_leaflet_rectangles_path']);
    }
  }

  // circles
  if ($defaults['circles_enable'] && $defaults['circles_radius'] > 0 && (!empty($defaults['circles_coords']) || $defaults['circles_apply'])) {
    if ($defaults['circles_apply'] && count($latlons)) {

      // get latlons and set coords
      $tmp = '';
      foreach ($latlons as $ll) {
        $tmp .= $ll[0] . ',' . $ll[1] . "\n";
      }
      if ($tmp) {
        $defaults['circles_coords'] = $tmp;
      }
    }
    $circles = getlocations_get_circle_settings($defaults);
    if ($circles) {
      $circle_settings = array(
        $mapid => $circles,
      );
      drupal_add_js(array(
        'getlocations_leaflet_circles' => $circle_settings,
      ), 'setting');
      drupal_add_js($getlocations_leaflet_paths['getlocations_leaflet_circles_path']);
    }
  }

  // polylines
  if ($defaults['polylines_enable'] && !empty($defaults['polylines_coords'])) {
    $polylines = getlocations_get_polyline_settings($defaults);
    if ($polylines) {
      $polyline_settings = array(
        $mapid => $polylines,
      );
      drupal_add_js(array(
        'getlocations_leaflet_polylines' => $polyline_settings,
      ), 'setting');
      drupal_add_js($getlocations_leaflet_paths['getlocations_leaflet_polylines_path']);
    }
  }

  // geojson
  if ($defaults['geojson_enable'] && !empty($defaults['geojson_data']) && ($geojson_path = getlocations_get_geojson_path())) {
    drupal_add_js($geojson_path);
    $geojson_settings = array(
      $mapid => array(
        'geojson_data' => $defaults['geojson_data'],
        'geojson_options' => $defaults['geojson_options'],
      ),
    );
    drupal_add_js(array(
      'getlocations_leaflet_geojson' => $geojson_settings,
    ), 'setting');
    drupal_add_js($getlocations_leaflet_paths['getlocations_leaflet_geojson_path']);
  }
  return $map_settings;
}