You are here

function getlocations_fields_field_formatter_settings_form in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_fields/getlocations_fields.module \getlocations_fields_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_fields/getlocations_fields.module, line 804
getlocations_fields.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_fields_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $getlocations_fields_paths = getlocations_fields_paths_get();
  drupal_add_js($getlocations_fields_paths['getlocations_fields_formatter_path']);
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $getlocations_fields_defaults = getlocations_fields_defaults();
  if (empty($settings)) {
    $settings = $getlocations_fields_defaults;
  }

  // $instance['entity_type'] contains node, user etc
  $entity_type = $instance['entity_type'];
  $element = array();

  // address display options
  $element += getlocations_fields_display_settings_form($settings);
  $element['display_mapwidth']['#element_validate'] = array(
    'getlocations_element_validate_dim',
  );
  $element['display_mapheight']['#element_validate'] = array(
    'getlocations_element_validate_dim',
  );

  // map display options
  $element += getlocations_map_display_options_form($settings, FALSE);

  // 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);
  unset($element['#theme']);
  $element['#theme'] = 'getlocations_fields_field_formatter_settings_form';
  return $element;
}