You are here

function geolocation_views_plugin_style_google_map::options_form in Geolocation Views 7

Options form.

Overrides views_plugin_style::options_form

File

./geolocation_views_plugin_style_google_map.inc, line 35

Class

geolocation_views_plugin_style_google_map

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $zoom_options = drupal_map_assoc(array(
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    16,
    17,
    18,
    19,
  ));
  $field_options = array(
    '' => t('< none >'),
  );
  $fields = $this->display->handler
    ->get_handlers('field');
  foreach ($fields as $id => $handler) {
    $field_options[$id] = $handler
      ->ui_name(FALSE);
  }
  $form['map_width'] = array(
    '#title' => t('Map width'),
    '#type' => 'textfield',
    '#default_value' => $this->options['map_width'],
    '#size' => 5,
  );
  $form['map_height'] = array(
    '#title' => t('Map height'),
    '#type' => 'textfield',
    '#default_value' => $this->options['map_height'],
    '#size' => 5,
  );
  $form['map_center'] = array(
    '#title' => t('Map center'),
    '#type' => 'textfield',
    '#default_value' => $this->options['map_center'],
    '#size' => 40,
  );
  $form['map_zoom'] = array(
    '#title' => t('Map zoom'),
    '#type' => 'select',
    '#options' => $zoom_options,
    '#default_value' => $this->options['map_zoom'],
  );
  $form['map_min_zoom'] = array(
    '#title' => t('Minimum map zoom'),
    '#type' => 'select',
    '#options' => $zoom_options,
    '#default_value' => $this->options['map_min_zoom'],
  );
  $form['map_max_zoom'] = array(
    '#title' => t('Maximum map zoom'),
    '#type' => 'select',
    '#options' => $zoom_options,
    '#default_value' => $this->options['map_max_zoom'],
  );
  $form['map_type'] = array(
    '#title' => t('Map type'),
    '#type' => 'select',
    '#options' => drupal_map_assoc(array(
      'ROADMAP',
      'SATELLITE',
      'HYBRID',
      'TERRAIN',
    )),
    '#default_value' => $this->options['map_type'],
  );
  $form['marker_icon_field'] = array(
    '#title' => t('Marker icon field'),
    '#type' => 'select',
    '#options' => $field_options,
    '#default_value' => $this->options['marker_icon_field'],
  );
  $form['marker_url_field'] = array(
    '#title' => t('Marker url field'),
    '#type' => 'select',
    '#options' => $field_options,
    '#default_value' => $this->options['marker_url_field'],
  );
  $form['marker_title_field'] = array(
    '#title' => t('Marker title field'),
    '#type' => 'select',
    '#options' => $field_options,
    '#default_value' => $this->options['marker_title_field'],
  );
  $form['use_marker_clusterer'] = array(
    '#title' => t('Use MarkerClusterer'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['use_marker_clusterer'],
  );
  $form['marker_clusterer'] = array(
    '#title' => t('MarkerClusterer options'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#states' => array(
      'visible' => array(
        '#edit-style-options-use-marker-clusterer' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['marker_clusterer']['grid_size'] = array(
    '#title' => t('Grid size'),
    '#description' => t('The grid size of a cluster in pixel. Each cluster will be a square. If you want the algorithm to run faster, you can set this value larger. The default value is 60.'),
    '#type' => 'textfield',
    '#default_value' => $this->options['marker_clusterer']['grid_size'],
    '#size' => 5,
  );
  $form['marker_clusterer']['max_zoom'] = array(
    '#title' => t('Max zoom'),
    '#description' => t('The max zoom level monitored by a marker cluster. If not given, the marker cluster assumes the maximum map zoom level. When maxZoom is reached or exceeded all markers will be shown without cluster.'),
    '#type' => 'select',
    '#options' => array(
      '' => t('- none -'),
    ) + $zoom_options,
    '#default_value' => $this->options['marker_clusterer']['max_zoom'],
  );
  $form['marker_clusterer']['icon_url'] = array(
    '#title' => t('Custom icon url'),
    '#description' => t('The image url.'),
    '#type' => 'textfield',
    '#default_value' => $this->options['marker_clusterer']['icon_url'],
  );
  $form['marker_clusterer']['icon_size'] = array(
    '#title' => t('Custom icon size'),
    '#description' => t('The image width and height. Example: 32x32'),
    '#type' => 'textfield',
    '#default_value' => $this->options['marker_clusterer']['icon_size'],
    '#size' => 5,
    '#states' => array(
      'visible' => array(
        '#edit-style-options-use-marker-clusterer' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['map_auto_center_and_zoom'] = array(
    '#title' => t('Automatically center and zoom map'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['map_auto_center_and_zoom'],
  );
  $form['map_disable_scroll_wheel'] = array(
    '#title' => t('Disable scroll wheel'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['map_disable_scroll_wheel'],
  );
  $form['map_disable_double_click_zoom'] = array(
    '#title' => t('Disable double click zoom'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['map_disable_double_click_zoom'],
  );
}