You are here

function getlocations_leaflet_display_options_form in Get Locations 7

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

Function

Return value

Returns

3 calls to getlocations_leaflet_display_options_form()
getlocations_leaflet_field_formatter_settings_form in modules/getlocations_leaflet/getlocations_leaflet.module
Implements hook_field_formatter_settings_form(). Returns form elements for a formatter's settings.
getlocations_leaflet_plugin_style::options_form in modules/getlocations_leaflet/views/getlocations_leaflet_plugin_style.inc
Options form
getlocations_leaflet_settings_form in modules/getlocations_leaflet/getlocations_leaflet.module
Function

File

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

Code

function getlocations_leaflet_display_options_form($defaults, $admin = FALSE) {
  $form = array();
  $form['#theme'][] = 'getlocations_leaflet_display_options_form';
  $getlocations_leaflet_paths = getlocations_leaflet_paths_get();

  #$form['#attached']['js'] = array($getlocations_leaflet_paths['getlocations_leaflet_formatter_path'] => array('type' => 'file' ) );
  drupal_add_js($getlocations_leaflet_paths['getlocations_leaflet_formatter_path']);
  $controlpositions = getlocations_leaflet_controlpositions();
  $getlocations_leaflet_plugins = getlocations_leaflet_plugins();
  $mapquest_lic = variable_get('getlocations_mapquest_lic', array(
    'key' => '',
    'type' => 'l',
  ));
  $form['nodezoom'] = getlocations_element_map_zoom(t('Default Zoom for Single location'), $defaults['nodezoom'], t('The Default zoom level for a single marker.'));
  $form['scrollWheelZoom'] = getlocations_element_map_checkbox(t('Scrollwheel'), $defaults['scrollWheelZoom'], t('Enable scrollwheel zooming.'));
  $form['touchZoom'] = getlocations_element_map_checkbox(t('Touch Zoom'), $defaults['touchZoom'], t('Enable touch zooming. Applies to touchscreens.'));
  $form['dragging'] = getlocations_element_map_checkbox(t('Draggable'), $defaults['dragging'], t('Enable dragging the map.'));
  $form['doubleClickZoom'] = getlocations_element_map_checkbox(t('DoubleClick Zoom'), $defaults['doubleClickZoom'], t('Enable DoubleClick Zooming.'));
  $form['boxZoom'] = getlocations_element_map_checkbox(t('Box Zoom'), $defaults['boxZoom'], t('Enable Box Zooming.'));
  $form['tap'] = getlocations_element_map_checkbox(t('Tap'), $defaults['tap'], t('Enable Tap. Applies to touchscreens.'));
  $form['tapTolerance'] = getlocations_element_map_tf(t('Tap Tolerance'), $defaults['tapTolerance'], t('Set tap tolerance.'), 5);
  $form['bounceAtZoomLimits'] = getlocations_element_map_checkbox(t('bounce At Zoom Limits'), $defaults['bounceAtZoomLimits'], t('Enable bounce At Zoom Limits.'));

  // mapquest
  if ($getlocations_leaflet_plugins['mapquest_maps_enable']) {
    $form['mapquest_maps_use'] = getlocations_element_map_checkbox(t('Enable Mapquest maps'), $defaults['mapquest_maps_use']);
    $form['mapquest_maps_use']['#suffix'] = '<div id="wrap-getlocations-mapquest-maps-use">';
    $mapopts = array();
    if ($defaults['mapquest_maps_maplayer']) {
      $mapopts['m'] = t('Map layer');
    }
    if ($defaults['mapquest_maps_satellitelayer']) {
      $mapopts['s'] = t('Satellite layer');
    }
    if ($defaults['mapquest_maps_hybridlayer']) {
      $mapopts['h'] = t('Hybrid layer');
    }
    if (count($mapopts) < 1) {
      $mapopts['m'] = t('Map layer');
      $defaults['mapquest_maps_maplayer'] = 1;
    }
    $form['mapquest_maps_default'] = getlocations_element_dd(t('Default map'), $defaults['mapquest_maps_default'], $mapopts);
    $form['mapquest_maps_maplayer'] = getlocations_element_map_checkbox(t('Map layer'), $defaults['mapquest_maps_maplayer']);
    $form['mapquest_maps_satellitelayer'] = getlocations_element_map_checkbox(t('Satellite layer'), $defaults['mapquest_maps_satellitelayer']);
    $form['mapquest_maps_hybridlayer'] = getlocations_element_map_checkbox(t('Hybrid layer'), $defaults['mapquest_maps_hybridlayer']);
    $form['mapquest_maps_hybridlayer']['#suffix'] = '</div>';
  }
  else {
    $form['mapquest_maps_default'] = array(
      '#type' => 'value',
      '#value' => 'm',
    );
    $form['mapquest_maps_maplayer'] = array(
      '#type' => 'value',
      '#value' => 1,
    );
    $form['mapquest_maps_satellitelayer'] = array(
      '#type' => 'value',
      '#value' => 1,
    );
    $form['mapquest_maps_hybridlayer'] = array(
      '#type' => 'value',
      '#value' => 1,
    );
  }
  if ($getlocations_leaflet_plugins['mapquest_traffic_enable'] && $mapquest_lic['type'] == 'l') {
    $form['mapquest_traffic_flow'] = getlocations_element_map_checkbox(t('Enable traffic flow'), $defaults['mapquest_traffic_flow'], t('Enable Traffic Flow on the map. Limited Availability.'));
    $form['mapquest_traffic_flow_on'] = getlocations_element_map_checkbox(t('Show traffic flow'), $defaults['mapquest_traffic_flow_on'], t('Show Traffic Flow on the map on startup.'));
    $form['mapquest_traffic_incident'] = getlocations_element_map_checkbox(t('Enable traffic incident'), $defaults['mapquest_traffic_incident'], t('Enable Traffic Incident on the map. Limited Availability.'));
    $form['mapquest_traffic_incident_on'] = getlocations_element_map_checkbox(t('Show traffic incident'), $defaults['mapquest_traffic_incident_on'], t('Show Traffic Incident on the map on startup.'));
    $form['mapquest_traffic_incident_on']['#suffix'] = '';
  }
  else {
    $form['mapquest_traffic_flow'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
    $form['mapquest_traffic_flow_on'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
    $form['mapquest_traffic_incident'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
    $form['mapquest_traffic_incident_on'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
    $form['mapquest_traffic_incident_on']['#suffix'] = '';
  }
  $form['scaleControl'] = getlocations_element_map_checkbox(t('Scale'), $defaults['scaleControl'], t('Show scale.'));
  $form['scaleControl']['#suffix'] = '<div id="wrap-getlocations-scalecontrol">';
  $form['scalecontrolunits'] = getlocations_element_dd(t('Distance Units'), $defaults['scalecontrolunits'], array(
    '' => t('Defaults'),
    'metric' => t('Metric'),
    'imperial' => t('Imperial'),
  ));
  $form['scalecontrolposition'] = getlocations_element_dd(t('Position of Scale Control'), $defaults['scalecontrolposition'], $controlpositions);
  $form['scalecontrolposition']['#suffix'] = '</div>';
  $form['zoomControl'] = getlocations_element_map_checkbox(t('Zoom Control'), $defaults['zoomControl'], t('Enable Zoom Control on the map.'));
  $form['zoomControl']['#suffix'] = '<div id="wrap-getlocations-zoomcontrol">';
  $form['zoomcontrolposition'] = getlocations_element_dd(t('Position of Zoom Control'), $defaults['zoomcontrolposition'], $controlpositions);
  $form['zoomcontrolposition']['#suffix'] = '</div>';
  $form['attributionControl'] = getlocations_element_map_checkbox(t('Attribution Control'), $defaults['attributionControl'], t('Enable Attribution Control on the map.'));
  $form['attributionControl']['#suffix'] = '<div id="wrap-getlocations-attributioncontrol">';
  $form['attributioncontrolposition'] = getlocations_element_dd(t('Position of Attribution Control'), $defaults['attributioncontrolposition'], $controlpositions);
  $form['attributioncontrolposition']['#suffix'] = '</div>';
  if ($getlocations_leaflet_plugins['geocoder_enable']) {
    $form['geocoder'] = getlocations_element_map_checkbox(t('Geocoder Control'), $defaults['geocoder']);
    $form['geocoder']['#suffix'] = '<div id="wrap-getlocations-geocoder">';
    $form['geocoderposition'] = getlocations_element_dd(t('Position of Geocoder Control'), $defaults['geocoderposition'], $controlpositions);
    $apikey = variable_get('getlocations_api3_key', '');
    $mapquest_lic = variable_get('getlocations_mapquest_lic', array(
      'key' => '',
      'type' => 'l',
    ));
    $sources = array(
      'n' => t('Nominatim'),
      'b' => t('Bing'),
      'x' => t('Mapbox'),
    );
    if ($apikey) {
      $sources['g'] = t('Google');
    }
    if ($mapquest_lic['key']) {
      $sources['m'] = t('Mapquest');
    }
    $form['geocodersrc'] = getlocations_element_dd(t('Geocoding source'), $defaults['geocodersrc'], $sources, t('Only Nominatim is GPL'));
    $form['geocoder_bing_key'] = getlocations_element_map_tf(t('Bing Geocoder key'), $defaults['geocoder_bing_key'], t('A Geocoder key is required for Bing.'), 40);
    $form['geocoder_mapbox_key'] = getlocations_element_map_tf(t('Mapbox Geocoder key'), $defaults['geocoder_mapbox_key'], t('A Geocoder key is required for Mapbox.'), 40);
    $form['geocoder_placeholder'] = getlocations_element_map_tf(t('Placeholder'), $defaults['geocoder_placeholder'], '', 30);
    $form['geocoder_errormessage'] = getlocations_element_map_tf(t('Error Message'), $defaults['geocoder_errormessage'], '', 30);
    $form['geocodercollapsed'] = getlocations_element_map_checkbox(t('Geocoder Collapsed'), $defaults['geocodercollapsed']);
    $form['geocodercollapsed']['#suffix'] = '</div>';
  }
  else {
    $form['geocoder'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }

  // usermarker
  if ($getlocations_leaflet_plugins['usermarker_enable']) {
    $form['usermarker'] = getlocations_element_map_checkbox(t('Usermarker'), $defaults['usermarker'], t('Show user position.'));
    $form['usermarker']['#suffix'] = '<div id="wrap-getlocations-usermarker">';
    $form['usermarker_button_label'] = getlocations_element_map_tf(t('GPS button label'), $defaults['usermarker_button_label'], '', 30, 30, TRUE);
    $form['usermarker_pulsing'] = getlocations_element_map_checkbox(t('Usermarker pulsing'), $defaults['usermarker_pulsing']);
    $form['usermarker_smallicon'] = getlocations_element_map_checkbox(t('Usermarker Small Icon'), $defaults['usermarker_smallicon']);
    $form['usermarker_accuracy'] = getlocations_element_map_checkbox(t('Usermarker accuracy'), $defaults['usermarker_accuracy'], t('Show Geolocation accuracy as a circle'));
    $form['usermarker_circle_stroke'] = getlocations_element_map_checkbox(t('Accuracy circle stroke'), $defaults['usermarker_circle_stroke'], t('Show Geolocation accuracy circle with a border.'));

    // jquery_colorpicker
    if (module_exists('jquery_colorpicker') && $defaults['jquery_colorpicker_enabled']) {
      $form['usermarker_circle_strokecolor'] = array(
        '#type' => 'jquery_colorpicker',
        '#title' => t('Accuracy Circle line color'),
        '#default_value' => preg_replace("/^#/", '', $defaults['usermarker_circle_strokecolor']),
        '#description' => t('Click on the Colorpicker icon to select a color'),
      );
    }
    else {
      $form['usermarker_circle_strokecolor'] = getlocations_element_map_tf(t('Accuracy Circle line color'), $defaults['usermarker_circle_strokecolor'], t('HTML hex, eg #FF0000.'), 10, 10, TRUE);
    }
    $form['usermarker_circle_strokeopacity'] = getlocations_element_map_tf(t('Accuracy Circle line opacity'), $defaults['usermarker_circle_strokeopacity'], t('Must be between 0 and 1.'), 10, 10, TRUE);
    $form['usermarker_circle_strokeweight'] = getlocations_element_map_tf(t('Accuracy Circle line thickness'), $defaults['usermarker_circle_strokeweight'], t('Must be an integer.'), 10, 10, TRUE);

    // jquery_colorpicker
    if (module_exists('jquery_colorpicker') && $defaults['jquery_colorpicker_enabled']) {
      $form['usermarker_circle_fillcolor'] = array(
        '#type' => 'jquery_colorpicker',
        '#title' => t('Accuracy Circle fill color'),
        '#default_value' => preg_replace("/^#/", '', $defaults['usermarker_circle_fillcolor']),
        '#description' => t('Click on the Colorpicker icon to select a color'),
      );
    }
    else {
      $form['usermarker_circle_fillcolor'] = getlocations_element_map_tf(t('Accuracy Circle fill color'), $defaults['usermarker_circle_fillcolor'], t('HTML hex, eg #FF0000.'), 10, 10, TRUE);
    }
    $form['usermarker_circle_fillopacity'] = getlocations_element_map_tf(t('Accuracy Circle fill opacity'), $defaults['usermarker_circle_fillopacity'], t('Must be between 0 and 1.'), 10, 10, TRUE);
    $form['usermarker_circle_fillopacity']['#suffix'] = '</div>';
  }
  else {
    $form['usermarker'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }

  // bouncemarker
  if ($getlocations_leaflet_plugins['bouncemarker_enable']) {
    $form['bouncemarker'] = getlocations_element_map_checkbox(t('Bounce markers'), $defaults['bouncemarker'], t('Bounce markers on adding to the map.'));
    $form['bouncemarker']['#suffix'] = '<div id="wrap-getlocations-bouncemarker">';
    $form['bouncemarker_duration'] = getlocations_element_map_tf(t('Bouncemarker duration'), $defaults['bouncemarker_duration'], t('Must be a number, in milliseconds.'), 10, 10, TRUE);
    $form['bouncemarker_height'] = getlocations_element_map_tf(t('Bouncemarker height'), $defaults['bouncemarker_height'], t('A number, in pixels. If left empty will drop from the top of the map.'), 10, 10, FALSE);
    $form['bouncemarker_height']['#suffix'] = '</div>';
  }
  else {
    $form['bouncemarker'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }

  // Magnifying Glass
  if ($getlocations_leaflet_plugins['magnifyingglass_enable']) {
    $form['magnifyingglass'] = getlocations_element_map_checkbox(t('Magnifying Glass'), $defaults['magnifyingglass'], t('Magnifying Glass on the map.'));
    $form['magnifyingglass']['#suffix'] = '<div id="wrap-getlocations-magnifyingglass">';
    $form['magnifyingglasscontrolposition'] = getlocations_element_dd(t('Position of Magnifying Glass Control'), $defaults['magnifyingglasscontrolposition'], $controlpositions);
    $form['magnifyingglassradius'] = getlocations_element_map_tf(t('Magnifying Glass Radius'), $defaults['magnifyingglassradius'], '', 10, 10, TRUE);
    $form['magnifyingglasszoomoffset'] = getlocations_element_map_tf(t('Magnifying Glass Zoom Offset'), $defaults['magnifyingglasszoomoffset'], '', 10, 10, TRUE);
    $form['magnifyingglasszoomoffset']['#suffix'] = '</div>';
  }
  else {
    $form['magnifyingglass'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }

  // Terminator
  if ($getlocations_leaflet_plugins['terminator_enable']) {
    $form['terminator'] = getlocations_element_map_checkbox(t('Day/Night'), $defaults['terminator'], t('Show Day and Night on the map.'));
    $form['terminator']['#suffix'] = '<div id="wrap-getlocations-terminator">';

    // jquery_colorpicker
    if (module_exists('jquery_colorpicker') && $defaults['jquery_colorpicker_enabled']) {
      $form['terminator_strokecolor'] = array(
        '#type' => 'jquery_colorpicker',
        '#title' => t('Day/Night line color'),
        '#default_value' => preg_replace("/^#/", '', $defaults['terminator_strokecolor']),
        '#description' => t('Click on the Colorpicker icon to select a color'),
      );
    }
    else {
      $form['terminator_strokecolor'] = getlocations_element_map_tf(t('Day/Night line color'), $defaults['terminator_strokecolor'], t('HTML hex, eg #000000.'), 10, 10, TRUE);
    }
    $form['terminator_strokeopacity'] = getlocations_element_map_tf(t('Day/Night line opacity'), $defaults['terminator_strokeopacity'], t('Must be between 0 and 1.'), 10, 10, TRUE);
    $form['terminator_strokeweight'] = getlocations_element_map_tf(t('Day/Night line thickness'), $defaults['terminator_strokeweight'], t('Must be an integer.'), 10, 10, TRUE);

    // jquery_colorpicker
    if (module_exists('jquery_colorpicker') && $defaults['jquery_colorpicker_enabled']) {
      $form['terminator_fillcolor'] = array(
        '#type' => 'jquery_colorpicker',
        '#title' => t('Day/Night fill color'),
        '#default_value' => preg_replace("/^#/", '', $defaults['terminator_fillcolor']),
        '#description' => t('Click on the Colorpicker icon to select a color'),
      );
    }
    else {
      $form['terminator_fillcolor'] = getlocations_element_map_tf(t('Day/Night fill color'), $defaults['terminator_fillcolor'], t('HTML hex, eg #000000.'), 10, 10, TRUE);
    }
    $form['terminator_fillopacity'] = getlocations_element_map_tf(t('Day/Night fill opacity'), $defaults['terminator_fillopacity'], t('Must be between 0 and 1.'), 10, 10, TRUE);
    $form['terminator_show'] = getlocations_element_dd(t('Day/Night show options'), $defaults['terminator_show'], array(
      0 => t('Always show'),
      1 => t('Checkbox on Layercontrol'),
      2 => t('Button on the map'),
    ));
    $form['terminator_position'] = getlocations_element_dd(t('Position of Day/Night Control'), $defaults['terminator_position'], $controlpositions);
    $form['terminator_state'] = getlocations_element_map_checkbox(t('Day/Night Initial state'), $defaults['terminator_state'], t('Day and Night on  or off initially.'));
    $form['terminator_label'] = getlocations_element_map_tf(t('Day/Night Label'), $defaults['terminator_label'], t('The label to display on the Layer Control or Tooltip.'), 20);
    $form['terminator_label']['#suffix'] = '</div>';
  }
  else {
    $form['terminator'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  $form['layerControl'] = getlocations_element_map_checkbox(t('Layer Control'), $defaults['layerControl'], t('Enable Layer Control on the map.'));
  $form['layerControl']['#suffix'] = '<div id="wrap-getlocations-layercontrol">';
  if ($getlocations_leaflet_plugins['minimap_enable']) {
    $form['minimap'] = getlocations_element_map_checkbox(t('Minimap Enhanced Layer Control'), $defaults['minimap']);
  }
  else {
    $form['minimap'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  $form['layercontrol_mark_ov'] = getlocations_element_map_checkbox(t('Layer Control Marker Overlay'), $defaults['layercontrol_mark_ov'], t('Add a checkbox to switch Markers on and off to the Layer Control.'));
  $form['layercontrol_mark_ov_label'] = getlocations_element_map_tf(t('Layer Control Marker Overlay Label'), $defaults['layercontrol_mark_ov_label'], t('The label to display on the Layer Control.'), 20);
  $form['layercontrol_circ_ov'] = getlocations_element_map_checkbox(t('Layer Control Circles Overlay'), $defaults['layercontrol_circ_ov'], t('Add a checkbox to switch Circles on and off to the Layer Control.'));
  $form['layercontrol_circ_ov_label'] = getlocations_element_map_tf(t('Layer Control Circles Overlay Label'), $defaults['layercontrol_circ_ov_label'], t('The label to display on the Layer Control.'), 20);
  $form['layercontrol_polyl_ov'] = getlocations_element_map_checkbox(t('Layer Control Lines Overlay'), $defaults['layercontrol_polyl_ov'], t('Add a checkbox to switch Lines on and off to the Layer Control.'));
  $form['layercontrol_polyl_ov_label'] = getlocations_element_map_tf(t('Layer Control Lines Overlay Label'), $defaults['layercontrol_polyl_ov_label'], t('The label to display on the Layer Control.'), 20);
  $form['layercontrol_polyg_ov'] = getlocations_element_map_checkbox(t('Layer Control Polygons Overlay'), $defaults['layercontrol_polyg_ov'], t('Add a checkbox to switch Polygons on and off to the Layer Control.'));
  $form['layercontrol_polyg_ov_label'] = getlocations_element_map_tf(t('Layer Control Polygons Overlay Label'), $defaults['layercontrol_polyg_ov_label'], t('The label to display on the Layer Control.'), 20);
  $form['layercontrol_rect_ov'] = getlocations_element_map_checkbox(t('Layer Control Rectangles Overlay'), $defaults['layercontrol_rect_ov'], t('Add a checkbox to switch Rectangles on and off to the Layer Control.'));
  $form['layercontrol_rect_ov_label'] = getlocations_element_map_tf(t('Layer Control Rectangles Overlay Label'), $defaults['layercontrol_rect_ov_label'], t('The label to display on the Layer Control.'), 20);
  $form['layercontrolposition'] = getlocations_element_dd(t('Position of Layer Control'), $defaults['layercontrolposition'], $controlpositions);
  $form['layercontrolposition']['#suffix'] = '</div>';

  // baselayers
  $map_settings = getlocations_leaflet_map_get_info('Getlocations OSM');
  $map_settings = getlocations_leaflet_get_map_layers($map_settings);
  $map_layers = $map_settings['map_layers'];

  // reconfigure $defaults['baselayers']
  $old_baselayers = $defaults['baselayers'];
  $defaults['baselayers'] = array();
  $default_baselayer_opts = array();
  foreach ($map_layers as $k => $v) {
    if ($k == $defaults['default_baselayer']) {
      $defaults['baselayers'][$k] = isset($old_baselayers[$k]) ? $old_baselayers[$k] : 1;
    }
    else {
      $defaults['baselayers'][$k] = isset($old_baselayers[$k]) ? $old_baselayers[$k] : 0;
    }

    // make a list of enable baselayers for a dropdown
    if (isset($old_baselayers[$k]) && $old_baselayers[$k]) {
      if ($map_layers[$k]['type'] == 'base') {
        $default_baselayer_opts[$k] = $map_layers[$k]['label'];
      }
    }
  }
  if (count($default_baselayer_opts) > 1) {
    $form['default_baselayer'] = getlocations_element_dd(t('Default Map'), $defaults['default_baselayer'], $default_baselayer_opts);
  }
  else {
    $form['default_baselayer'] = array(
      '#type' => 'value',
      '#value' => $defaults['default_baselayer'],
    );
  }
  $form['baselayers'] = array(
    '#type' => 'fieldset',
    '#title' => t('Enable map types'),
    '#description' => t('Select which maps you want to be available. You must select at least one'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  foreach ($defaults['baselayers'] as $key => $value) {
    $label = isset($map_layers[$key]['label']) ? $map_layers[$key]['label'] : $key;
    $form['baselayers'][$key] = getlocations_element_map_checkbox($label, $defaults['baselayers'][$key], isset($map_layers[$key]['description']) ? $map_layers[$key]['description'] : '');
  }
  $form['trackResize'] = getlocations_element_map_checkbox(t('Automatic Resizing'), $defaults['trackResize'], t('Enable Automatic Resizing of the map.'));
  $form['fadeAnimation'] = getlocations_element_map_checkbox(t('fadeAnimation'), $defaults['fadeAnimation'], t('Enable fadeAnimation on the map.'));
  $form['zoomAnimation'] = getlocations_element_map_checkbox(t('zoomAnimation'), $defaults['zoomAnimation'], t('Enable zoomAnimation on the map.'));
  $form['closePopupOnClick'] = getlocations_element_map_checkbox(t('closePopupOnClick'), $defaults['closePopupOnClick'], t('Enable closePopupOnClick on the map.'));

  // plugins
  if ($getlocations_leaflet_plugins['markercluster_enable']) {
    $form['markercluster'] = getlocations_element_map_checkbox(t('Marker Cluster'), $defaults['markercluster'], t('Enable markercluster on the map.'));
  }
  else {
    $form['markercluster'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  if ($getlocations_leaflet_plugins['fullscreen_enable']) {

    // fullscreen
    $form['fullscreen'] = getlocations_element_map_checkbox(t('Fullscreen'), $defaults['fullscreen'], t('Enable Fullscreen button on the map.'));
    $form['fullscreen']['#suffix'] = '<div id="getlocations-fullscreen-wrap">';
    $form['fullscreenposition'] = getlocations_element_dd(t('Position of Fullscreen Control'), $defaults['fullscreenposition'], $controlpositions);
    $form['fullscreenposition']['#suffix'] = '</div>';
  }
  else {
    $form['fullscreen'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
    $form['fullscreenposition'] = array(
      '#type' => 'value',
      '#value' => $defaults['fullscreenposition'],
    );
  }
  if ($getlocations_leaflet_plugins['graticule_enable']) {
    $form['graticule'] = getlocations_element_map_checkbox(t('Graticule'), $defaults['graticule'], t('Enable a grid on the map.'));
    $form['graticule']['#suffix'] = '<div id="getlocations-graticule-wrap">';
    $form['graticule_color'] = getlocations_element_map_tf(t('Graticule line color'), $defaults['graticule_color'], '', 10);
    $form['graticule_weight'] = getlocations_element_map_tf(t('Graticule line thickness'), $defaults['graticule_weight'], '', 5);
    $form['graticule_opacity'] = getlocations_element_map_tf(t('Graticule line opacity'), $defaults['graticule_opacity'], '', 5);
    $form['graticule_interval'] = getlocations_element_map_tf(t('Graticule interval'), $defaults['graticule_interval'], '', 5);
    $form['graticule_show'] = getlocations_element_dd(t('Graticule show options'), $defaults['graticule_show'], array(
      0 => t('Always show'),
      1 => t('Checkbox on Layercontrol'),
      2 => t('Button on the map'),
    ));
    $form['graticule_position'] = getlocations_element_dd(t('Position of Graticule Control'), $defaults['graticule_position'], $controlpositions);
    $form['graticule_state'] = getlocations_element_map_checkbox(t('Graticule initial state'), $defaults['graticule_state'], t('Initial state of Graticule.'));
    $form['graticule_ov_label'] = getlocations_element_map_tf(t('Graticule Label'), $defaults['graticule_ov_label'], t('The label to display on the Layer Control or Tooltip.'), 20);
    $form['graticule_ov_label']['#suffix'] = '</div>';
  }
  else {
    $form['graticule'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  if ($getlocations_leaflet_plugins['mouseposition_enable']) {
    $form['mouseposition'] = getlocations_element_map_checkbox(t('Mouseposition'), $defaults['mouseposition'], t('Enable Mouseposition on the map.'));
    $form['mouseposition']['#suffix'] = '<div id="getlocations-mouseposition-wrap">';
    $form['mouseposition_position'] = getlocations_element_dd(t('Position of Mouse position Control'), $defaults['mouseposition_position'], $controlpositions);
    $form['mouseposition_display_dms'] = getlocations_element_map_checkbox(t('Show Latitude/Longitude in Degrees, minutes, seconds'), $defaults['mouseposition_display_dms'], '');
    $form['mouseposition_display_dms']['#suffix'] = '</div>';
  }
  else {
    $form['mouseposition'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  if ($getlocations_leaflet_plugins['pancontrol_enable']) {
    $form['pancontrol'] = getlocations_element_map_checkbox(t('Pancontrol'), $defaults['pancontrol'], t('Enable Pan control on the map.'));
    $form['pancontrol']['#suffix'] = '<div id="getlocations-pancontrol-wrap">';
    $form['pancontrolposition'] = getlocations_element_dd(t('Position of Pan Control'), $defaults['pancontrolposition'], $controlpositions);
    $form['pancontrolposition']['#suffix'] = '</div>';
  }
  else {
    $form['pancontrol'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  if ($getlocations_leaflet_plugins['zoomslider_enable']) {
    $form['zoomslider'] = getlocations_element_map_checkbox(t('Zoomslider'), $defaults['zoomslider'], t('Enable Zoom Slider on the map.'));
    $form['zoomslider']['#suffix'] = '<div id="getlocations-zoomslider-wrap">';
    $form['zoomsliderposition'] = getlocations_element_dd(t('Position of Zoomslider'), $defaults['zoomsliderposition'], $controlpositions);
    $form['zoomsliderposition']['#suffix'] = '</div>';
  }
  else {
    $form['zoomslider'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }

  // leaflet hash
  if ($getlocations_leaflet_plugins['hash_enable']) {
    $form['hashurl'] = getlocations_element_map_checkbox(t('Hash Url'), $defaults['hashurl'], t('Enable Url Hash for the map.'));
  }
  else {
    $form['hashurl'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  $form['markeraction'] = getlocations_element_dd(t('Marker action'), $defaults['markeraction'], array(
    '' => t('None'),
    'popup' => t('Popup'),
    'link' => t('Link to content'),
  ));
  $form['show_maplinks'] = getlocations_element_map_checkbox(t('Show map links'), $defaults['show_maplinks'], t('Show a list of links to show Popup or go to Link on the map.'));
  $form['show_maplinks']['#suffix'] = '<div id="wrap-getlocations-maplinks">';
  $form['show_maplinks_viewport'] = getlocations_element_map_checkbox(t('Only Show map links in Viewport'), $defaults['show_maplinks_viewport']);
  $form['show_maplinks_viewport']['#suffix'] = '</div>';
  if (module_exists('getdirections')) {
    $form['getdirections_link'] = getlocations_element_map_checkbox(t('Link to Getdirections in popup'), $defaults['getdirections_link'], t('Include a link to the Getdirections page in Popup.'));
  }

  // shapes
  $form += getlocations_shapes_form($defaults, '');

  // geojson
  $form += getlocations_geojson_form($defaults);
  $form['geojson_options']['#type'] = 'hidden';
  $form += getlocations_what3words_form($defaults);
  if ($getlocations_leaflet_plugins['awesome_enable']) {
    $form['marker_type'] = getlocations_element_dd(t('Default Marker type'), $defaults['marker_type'], array(
      'gg' => t('Getlocations markers'),
      'fa' => t('Awesome Fonts markers'),
    ), t('If you change this setting, save the page and revisit the form to get the selected markerset.'));

    #if ($admin) {

    #  $form['marker_type']['#suffix'] = '<div id="getlocations-awesome-wrap">';

    #  $form += getlocations_leaflet_awesome_markers_elements_get($defaults);

    #  $form['awesome_marker_color']['#suffix'] = '</div>';

    #}
    $form['awesome'] = array(
      '#type' => 'value',
      '#value' => 1,
    );
  }
  else {
    $form['awesome_icon'] = array(
      '#type' => 'value',
      '#value' => $defaults['awesome_icon'],
    );
    $form['awesome_icon_color_selector'] = array(
      '#type' => 'value',
      '#value' => $defaults['awesome_icon_color_selector'],
    );
    $form['awesome_icon_color'] = array(
      '#type' => 'value',
      '#value' => $defaults['awesome_icon_color'],
    );
    $form['awesome_marker_color'] = array(
      '#type' => 'value',
      '#value' => $defaults['awesome_marker_color'],
    );
    $form['awesome_icon_type'] = array(
      '#type' => 'value',
      '#value' => $defaults['awesome_icon_type'],
    );
    $form['awesome_icon_size'] = array(
      '#type' => 'value',
      '#value' => $defaults['awesome_icon_size'],
    );
    $form['awesome_icon_flip'] = array(
      '#type' => 'value',
      '#value' => $defaults['awesome_icon_flip'],
    );
    $form['awesome_icon_html'] = array(
      '#type' => 'value',
      '#value' => $defaults['awesome_icon_html'],
    );
    $form['awesome_icon_class'] = array(
      '#type' => 'value',
      '#value' => $defaults['awesome_icon_class'],
    );
    $form['awesome'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  return $form;
}