You are here

function geocoder_field_field_formatter_settings_summary in Geocoder 7.2

Implements hook_field_formatter_settings_summary().

File

modules/geocoder_field/geocoder_field.module, line 742

Code

function geocoder_field_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  $geocoder_handlers = array_filter($settings['geocoder_handlers'], function ($v) {
    return (bool) $v['enabled'];
  });
  uasort($geocoder_handlers, function ($a, $b) {
    if ($a['enabled'] > $b['enabled']) {
      return -1;
    }
    elseif ($a['enabled'] < $b['enabled']) {
      return 1;
    }
    if ($a['weight'] < $b['weight']) {
      return -1;
    }
    elseif ($a['weight'] > $b['weight']) {
      return 1;
    }
    return 0;
  });
  $geocoder_handlers = implode(', ', array_keys($geocoder_handlers));
  $summary[] = t('Geocoder plugin: @data', array(
    '@data' => $geocoder_handlers,
  ));
  return implode('<br />', $summary);
}