You are here

function staticmap_field_formatter_settings_summary in Static Map 7

Implements hook_field_formatter_settings_summary().

File

./staticmap.module, line 316
SiteMap module.

Code

function staticmap_field_formatter_settings_summary($field, $instance, $view_mode) {

  // @TODO: Once we have ctools up and running,
  // this should display the chosen preset.
  $display = $instance['display'][$view_mode];
  if (empty($display['settings']['preset'])) {
    return t('No preset selected');
  }
  ctools_include('export');
  $preset = ctools_export_crud_load('staticmap_presets', $display['settings']['preset']);
  $preset_data = unserialize($preset->data);
  $preset_summary = '';
  if (!empty($preset_data['provider'])) {
    $provider = staticmap_load_provider($preset_data['provider']);
    $provider_summary = $provider
      ->fieldFormatterSettingsSummary($field, $instance, $view_mode, $preset_data);
  }
  return t('Map preset: @preset<br />Map Size: @map_size<br />@provider_summary', array(
    '@preset' => $preset->title,
    '@map_size' => $preset_data['mapsize'],
    '@provider_summary' => $provider_summary,
  ));
}