You are here

function getlocations_map_field_formatter_settings_summary in Get Locations 7.2

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

Implements hook_field_formatter_settings_summary(). Returns a short summary for the current formatter settings of an instance.

If an empty result is returned, the formatter is assumed to have no configurable settings, and no UI will be provided to display a settings form.

The field structure.

Parameters

$instance: The instance structure.

$view_mode: The view mode for which a settings summary is requested.

Return value

A string containing a short summary of the formatter settings.

File

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

Code

function getlocations_map_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  switch ($display['type']) {
    case 'getlocations_map_default':
      $default_settings = getlocations_map_map_formatter_defaults();
      $summary[] = t('Getlocations Map Field settings');
      if ($settings['pancontrol']) {
        $summary[] = t('Show Pan control: Yes');
      }
      if ($settings['mtc']) {
        $summary[] = t('Map control type: @c', array(
          '@c' => $settings['mtc'],
        ));
      }
      if ($settings['maptype']) {
        $summary[] = t('Default map type: @c', array(
          '@c' => $settings['maptype'],
        ));
      }
      $types = array();
      foreach ($settings['baselayers'] as $key => $value) {
        if ($value) {
          $types[] = $key;
        }
      }
      if (count($types)) {
        $m = implode(', ', $types);
        $summary[] = t('Enabled map types: @m', array(
          '@m' => $m,
        ));
      }
      if ($settings['scale']) {
        $summary[] = t('Show scale: Yes');
      }
      if ($settings['overview']) {
        $summary[] = t('Show overview map: Yes');
      }
      if ($settings['scrollwheel']) {
        $summary[] = t('Enable scrollwheel zooming: Yes');
      }
      if ($settings['draggable']) {
        $summary[] = t('Enable dragging the map: Yes');
      }
      if ($settings['sv_show']) {
        $summary[] = t('Show streetview pegman: Yes');
      }
      if ($settings['sv_showfirst']) {
        $summary[] = t('Show streetview first: Yes');
      }
      if ($settings['fullscreen']) {
        $summary[] = t('Show Fullscreen button: Yes');
      }
      if ($settings['show_bubble_on_one_marker']) {
        $summary[] = t('Show bubble on one marker: Yes');
      }
      $info_display = array();
      if ($settings['trafficinfo']) {
        $info_display[] = t('Traffic');
      }
      if ($settings['bicycleinfo']) {
        $info_display[] = t('Bicycling');
      }
      if ($settings['transitinfo']) {
        $info_display[] = t('Transit');
      }
      if ($settings['poi_show']) {
        $info_display[] = t('Points of Interest');
      }
      if ($settings['transit_show']) {
        $info_display[] = t('Transit Points');
      }
      if (count($info_display)) {
        $summary[] = t("Enabled information layers:") . '<br />' . implode(', ', $info_display);
      }
      if ($settings['map_backgroundcolor']) {
        $summary[] = t('Map background color: @c', array(
          '@c' => $settings['map_backgroundcolor'],
        ));
      }
      if ($settings['markeraction'] > 0) {
        if ($settings['markeraction'] == 1) {
          $msg = t('InfoWindow');
        }
        elseif ($settings['markeraction'] == 2) {
          $msg = t('InfoBubble');
        }
        else {
          $msg = t('Link');
        }
        if ($settings['markeractiontype'] == 2) {
          $msg2 = t('Mouse over');
        }
        else {
          $msg2 = t('Click');
        }
        $summary[] = t('Marker action: @a on @b', array(
          '@a' => $msg,
          '@b' => $msg2,
        ));
      }
      $summary[] = t('Zoom level: @z', array(
        '@z' => $settings['nodezoom'],
      ));
      if ($settings['polygons_enable']) {
        $summary[] = t('Enable polygons: Yes');
        if ($settings['polygons_clickable']) {
          $summary[] = t('Polygons clickable: Yes');
        }
      }
      if ($settings['rectangles_enable']) {
        $summary[] = t('Enable rectangles: Yes');
        if ($settings['rectangles_clickable']) {
          $summary[] = t('Rectangles clickable: Yes');
        }
      }
      if ($settings['circles_enable']) {
        $summary[] = t('Enable circles: Yes');
        if ($settings['circles_clickable']) {
          $summary[] = t('Circles clickable: Yes');
        }
      }
      if ($settings['polylines_enable']) {
        $summary[] = t('Enable polylines: Yes');
        if ($settings['polylines_clickable']) {
          $summary[] = t('Polylines clickable: Yes');
        }
      }

      // search_places
      if ($settings['search_places']) {
        $summary[] = t('Enable Search Places: Yes');
      }
      break;
    case 'getlocations_map_link':
      $default_settings = getlocations_map_link_formatter_defaults();
      $summary[] = t('Link Formatter settings');
      $summary[] = t('Text: %t', array(
        '%t' => $settings['text'],
      ));
      $summary[] = t('Option: %o', array(
        '%o' => $default_settings['text_options'][$settings['text_opt']],
      ));
      break;
  }
  return implode('<br />', $summary);
}