You are here

function imagecache_external_field_formatter_settings_summary in Imagecache External 7.2

Implements hook_field_formatter_settings_summary().

File

./imagecache_external.module, line 122
Allows the usage of Image Styles on external images.

Code

function imagecache_external_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  $image_styles = image_style_options(FALSE);

  // 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['imagecache_external_style']])) {
    $summary[] = t('Image style: @style', array(
      '@style' => $image_styles[$settings['imagecache_external_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['imagecache_external_link']])) {
    $summary[] = $link_types[$settings['imagecache_external_link']];
  }
  return implode('<br />', $summary);
}