You are here

function getlocations_map_field_formatter_settings_form in Get Locations 7

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

Implements hook_field_formatter_settings_form(). Returns form elements for a formatter's settings.

Parameters

$field: The field structure being configured.

$instance: The instance structure being configured.

$view_mode: The view mode being configured.

$form: The (entire) configuration form array, which will usually have no use here.

$form_state: The form state of the (entire) configuration form.

Return value

The form elements for the formatter settings.

File

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

Code

function getlocations_map_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $jq_upd = getlocations_check_jquery_version(TRUE);
  drupal_add_js(GETLOCATIONS_MAP_PATH . ($jq_upd ? '/js/getlocations_map_formatter_1.min.js' : '/js/getlocations_map_formatter.min.js'));
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array();
  switch ($display['type']) {
    case 'getlocations_map_default':
      $getlocations_map_defaults = getlocations_map_defaults();
      if (empty($settings)) {
        $settings = $getlocations_map_defaults;
      }
      $element += getlocations_map_display_basics_form($settings);
      $element['width']['#element_validate'] = array(
        'getlocations_element_validate_dim',
      );
      $element['height']['#element_validate'] = array(
        'getlocations_element_validate_dim',
      );
      $element['latlong']['#element_validate'] = array(
        'getlocations_element_validate_latlon',
      );
      $element['nodezoom'] = getlocations_element_map_zoom(t('Default Zoom for Single location'), $settings['nodezoom'], t('The Default zoom level for a single marker.'));
      $element += getlocations_map_display_options_form($settings, FALSE, TRUE);

      // markeraction
      $element += getlocations_markeraction_form($settings);
      if (module_exists('getdirections')) {
        $element['getdirections_link'] = getlocations_element_map_checkbox(t('Link to Getdirections in bubble'), $settings['getdirections_link'], t('Include a link to the Getdirections page in InfoBubble/InfoWindow.'));
      }

      // views_search_marker etc
      if (module_exists('views')) {
        $element += getlocations_fields_views_search_form($settings);
      }

      // streetview overlay settings
      $element += getlocations_fields_sv_control_form($settings);
      break;
    case 'getlocations_map_link':
      $element['text'] = array(
        '#type' => 'textfield',
        '#title' => t('Default text'),
        '#description' => t('The text to use if no other option is available.'),
        '#default_value' => $settings['text'],
        '#size' => 25,
      );
      $element['text_opt'] = array(
        '#type' => 'select',
        '#title' => t('Display format'),
        '#default_value' => $settings['text_opt'],
        '#options' => $settings['text_options'],
      );
      break;
  }
  return $element;
}