1 image.field.inc image_field_formatter_settings_summary($field, $instance, $view_mode)

Implements hook_field_formatter_settings_summary().

File

core/modules/image/image.field.inc, line 636
Implement an image field, based on the file module's file field.

Code

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

  $summary = array();

  $image_styles = image_style_options(FALSE, PASS_THROUGH);
  // Unset possible 'No defined styles' option.
  unset($image_styles['']);
  // Styles could be lost because of enabled/disabled modules that defines
  // their styles in code.
  if (isset($image_styles[$settings['image_style']])) {
    $summary[] = t('Image style: @style', array('@style' => $image_styles[$settings['image_style']]));
  }
  else {
    $summary[] = t('Original image');
  }

  $link_types = array(
    'content' => t('Linked to content'),
    'file' => t('Linked to file'),
  );
  // Display this setting only if image is linked.
  if (isset($link_types[$settings['image_link']])) {
    $summary[] = $link_types[$settings['image_link']];
  }

  // Display this setting only if image is floated.
  if (!empty($settings['image_float'])) {
    $summary[] = t('Floated: @side', array('@side' => $settings['image_float']));
  }

  if (!empty($settings['image_load']) && $settings['image_load'] != 'auto') {
    $summary[] = t('Loading: @speed', array('@speed' => $settings['image_load']));
  }

  return implode('<br />', $summary);
}