You are here

function geofield_map_plugin_style_map::options_form in Geofield 7.2

Same name and namespace in other branches
  1. 7 modules/geofield_map/includes/geofield_map_plugin_style_map.inc \geofield_map_plugin_style_map::options_form()

Options form

Overrides views_plugin_style::options_form

File

modules/geofield_map/includes/geofield_map_plugin_style_map.inc, line 50
This file holds style plugin for Geofield Maps

Class

geofield_map_plugin_style_map
@class Extension of the Views Plugin Syle for Geofield Map

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $container_id = '';
  $handlers = $this->display->handler
    ->get_handlers('field');
  $data_source_options = $popup_source_options = array(
    '' => '<none>',
  );
  foreach ($handlers as $handle) {
    $popup_source_options[$handle->options['id']] = !empty($handle->options['label']) ? $handle->options['label'] : $handle->options['id'];
    if (!empty($handle->field_info['type']) && $handle->field_info['type'] == 'geofield') {
      $data_source_options[$handle->options['id']] = !empty($handle->options['label']) ? $handle->options['label'] : $handle->options['id'];
    }
  }
  if (count($data_source_options) == 1) {
    $form['error'] = array(
      '#markup' => 'Please add at least 1 geofield to the view',
    );
  }
  else {

    // Map Preset
    $form['data_source'] = array(
      '#type' => 'select',
      '#title' => t('Data Source'),
      '#description' => t('Which field contains geodata?'),
      '#options' => $data_source_options,
      '#default_value' => $this->options['data_source'] ? $this->options['data_source'] : '',
    );
    $form['popup_source'] = array(
      '#type' => 'select',
      '#title' => t('Popup Text'),
      '#options' => $popup_source_options,
      '#default_value' => $this->options['popup_source'] ? $this->options['popup_source'] : '',
    );
    $form['alt_text'] = array(
      '#type' => 'textarea',
      '#title' => t('Alternate Text'),
      '#description' => t('This text shows up when a user does not have javascript enabled'),
      '#default_value' => $this->options['alt_text'] ? $this->options['alt_text'] : '',
    );
    $form = geofield_map_settings_form($this->options, $form);
  }
}