You are here

private function ip_geoloc_plugin_style_leaflet::_add_more_map_options in IP Geolocation Views & Maps 7

1 call to ip_geoloc_plugin_style_leaflet::_add_more_map_options()
ip_geoloc_plugin_style_leaflet::options_form in views/ip_geoloc_plugin_style_leaflet.inc
Implements options_form().

File

views/ip_geoloc_plugin_style_leaflet.inc, line 913

Class

ip_geoloc_plugin_style_leaflet

Code

private function _add_more_map_options(&$form, &$weight) {
  $selected_map = ip_geoloc_plugin_style_leaflet_map_get_info($this->options['map']);
  $zoom_top = 21;
  if (isset($selected_map['settings']['maxZoom'])) {
    $zoom_top = $selected_map['settings']['maxZoom'];
  }
  $form['map_options'] = array(
    '#title' => t('More map options'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    // Or: empty($this->options['map_options']['zoom']) ?
    '#collapsed' => TRUE,
    '#weight' => $weight++,
  );
  $form['map_options']['maxzoom'] = array(
    '#title' => t('Maximum zoom level (0..@zoomtop)', array(
      '@zoomtop' => $zoom_top,
    )),
    '#type' => 'textfield',
    '#size' => 2,
    '#default_value' => $this->options['map_options']['maxzoom'],
    '#description' => t('Note that not all maps support all zoom levels.'),
  );
  $initial_zoom_max = $zoom_top;
  if (is_numeric($this->options['map_options']['maxzoom'])) {
    $initial_zoom_max = min($zoom_top, $this->options['map_options']['maxzoom']);
  }
  $form['map_options']['zoom'] = array(
    '#title' => t('Initial zoom level (0..@maxzoom)', array(
      '@maxzoom' => $initial_zoom_max,
    )),
    '#type' => 'textfield',
    '#size' => 2,
    '#default_value' => $this->options['map_options']['zoom'],
    '#description' => t('Does not apply to auto-box centering except when only one or no markers are shown.'),
  );
  $form['map_options']['zoom_on_click'] = array(
    '#title' => t('Zoom-on-click zoom level (1..@maxzoom)', array(
      '@maxzoom' => $zoom_top,
    )),
    '#type' => 'textfield',
    '#size' => 2,
    '#default_value' => $this->options['map_options']['zoom_on_click'],
    '#description' => t('Level to zoom to when a marker is clicked. Leave blank to disable this feature.'),
  );
  $form['map_options']['center_lat'] = array(
    '#title' => t('Latitude of initial center of map'),
    '#type' => 'textfield',
    '#size' => 6,
    '#default_value' => $this->options['map_options']['center_lat'],
    '#description' => t('If both latitude and longitude are filled out, these override any centering option until the visitor changes their location.'),
  );
  $form['map_options']['center_lon'] = array(
    '#title' => t('Longitude of initial center of map'),
    '#type' => 'textfield',
    '#size' => 6,
    '#default_value' => $this->options['map_options']['center_lon'],
    '#description' => t('If both latitude and longitude are filled out, these override any centering option until the visitor changes their location.'),
  );
  $form['map_options']['scrollwheelzoom'] = array(
    '#title' => t('Enable scroll wheel zoom'),
    '#type' => 'select',
    '#default_value' => $this->options['map_options']['scrollwheelzoom'],
    '#options' => array(
      TRUE => t('Yes'),
      FALSE => t('No'),
    ),
  );
  $form['map_options']['dragging'] = array(
    '#title' => t('Dragging/Panning of the map'),
    '#type' => 'select',
    '#default_value' => $this->options['map_options']['dragging'],
    '#options' => array(
      TRUE => t('Yes'),
      FALSE => t('No'),
    ),
  );
  $form['map_options']['separator'] = array(
    '#title' => t('Separator used in marker balloons'),
    '#type' => 'textfield',
    '#size' => 10,
    '#default_value' => $this->options['map_options']['separator'],
    '#description' => t('You may use most HTML tags.'),
  );
}