1 field_test.field.inc field_test_field_formatter_settings_summary($field, $instance, $view_mode)

Implements hook_field_formatter_settings_summary().

File

core/modules/field/tests/field_test/field_test.field.inc, line 330
Defines a field type and its formatters and widgets.

Code

function field_test_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];

  $summary = '';

  // The name of the setting depends on the formatter type.
  $map = array(
    'field_test_default' => 'test_formatter_setting',
    'field_test_multiple' => 'test_formatter_setting_multiple',
    'field_test_with_prepare_view' => 'test_formatter_setting_additional',
  );

  if (isset($map[$display['type']])) {
    $name = $map[$display['type']];
    $summary = t('@setting: @value', array('@setting' => $name, '@value' => $settings[$name]));
  }

  return $summary;
}