You are here

function field_test_field_formatter_settings_summary in Drupal 7

Implements hook_field_formatter_settings_summary().

File

modules/field/tests/field_test.field.inc, line 325
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;
}