You are here

function simple_gmap_field_formatter_settings_summary in Simple Google Maps 7

Implements hook_field_formatter_settings_summary().

File

./simple_gmap.module, line 286
Simple Google Maps module.

Code

function simple_gmap_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  if (!isset($settings['include_static_map'])) {
    $settings['include_static_map'] = 0;
  }
  $map_types = array(
    'm' => t('Map'),
    'k' => t('Satellite'),
    'h' => t('Hybrid'),
    'p' => t('Terrain'),
  );
  $map_type = isset($settings['map_type']) ? check_plain($settings['map_type']) : 'm';
  $map_type = isset($map_types[$map_type]) ? $map_types[$map_type] : $map_types['m'];
  $summary = array();
  if ($settings['include_map']) {
    $summary[] = t('Embedded map: @width x @height', array(
      '@width' => $settings['iframe_width'],
      '@height' => $settings['iframe_height'],
    ));
  }
  if ($settings['include_static_map']) {
    $summary[] = t('Static map: @width x @height, Scale: @static_scale', array(
      '@width' => $settings['iframe_width'],
      '@height' => $settings['iframe_height'],
      '@static_scale' => $settings['static_scale'],
    ));
  }
  if ($settings['include_link']) {
    $summary[] = t('Map link: @link_text', array(
      '@link_text' => $settings['link_text'],
    ));
  }
  if ($settings['include_map'] || $settings['include_static_map'] || $settings['include_link']) {
    $language = isset($display['settings']['langcode']) ? check_plain($display['settings']['langcode']) : 'en';
    $summary[] = t('Map Type: @map_type', array(
      '@map_type' => $map_type,
    ));
    $summary[] = t('Zoom Level: @zoom_level', array(
      '@zoom_level' => $settings['zoom_level'],
    ));
    $summary[] = t('Language: @language', array(
      '@language' => $language,
    ));
  }
  if ($settings['include_text']) {
    $summary[] = t('Original text displayed');
  }
  return implode(', ', $summary);
}