function hook_field_formatter_settings_summary

hook_field_formatter_settings_summary($field, $instance, $view_mode)

Return a short summary for the current formatter settings of an instance.

If an empty result is returned, the formatter is assumed to have no configurable settings, and no UI will be provided to display a settings form.

Parameters

$field: The field structure.

$instance: The instance structure.

$view_mode: The view mode for which a settings summary is requested.

Return value

A string containing a short summary of the formatter settings.

Related topics

File

modules/field_ui/field_ui.api.php, line 192
Hooks provided by the Field UI module.

Code

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

  $summary = '';

  if ($display['type'] == 'text_trimmed' || $display['type'] == 'text_summary_or_trimmed') {
    $summary = t('Length: @chars chars', array('@chars' => $settings['trim_length']));
  }

  return $summary;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field_ui!field_ui.api.php/function/hook_field_formatter_settings_summary/7.x