You are here

function colorbox_field_formatter_settings_summary in Colorbox 7

Same name and namespace in other branches
  1. 7.2 colorbox.module \colorbox_field_formatter_settings_summary()

Implements hook_field_formatter_settings_summary().

File

./colorbox.module, line 538
A light-weight, customizable lightbox plugin for jQuery 1.3

Code

function colorbox_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['colorbox_node_style']])) {
    $summary[] = t('Content image style: @style', array(
      '@style' => $image_styles[$settings['colorbox_node_style']],
    ));
  }
  elseif ($settings['colorbox_node_style'] == 'hide') {
    $summary[] = t('Content image style: Hide');
  }
  else {
    $summary[] = t('Content image style: Original image');
  }
  if (isset($image_styles[$settings['colorbox_image_style']])) {
    $summary[] = t('Colorbox image style: @style', array(
      '@style' => $image_styles[$settings['colorbox_image_style']],
    ));
  }
  else {
    $summary[] = t('Colorbox image style: Original image');
  }
  $gallery = array(
    'post' => t('Per post gallery'),
    'page' => t('Per page gallery'),
    'field_post' => t('Per field in post gallery'),
    'field_page' => t('Per field in page gallery'),
    'custom' => t('Custom'),
    'none' => t('No gallery'),
  );
  if (isset($settings['colorbox_gallery'])) {
    $summary[] = t('Colorbox gallery type: @type', array(
      '@type' => $gallery[$settings['colorbox_gallery']],
    )) . ($settings['colorbox_gallery'] == 'custom' ? ' (' . $settings['colorbox_gallery_custom'] . ')' : '');
  }
  $caption = array(
    'auto' => t('Automatic'),
    'title' => t('Title text'),
    'alt' => t('Alt text'),
    'node_title' => t('Content title'),
    'custom' => t('Custom (with tokens)'),
    'none' => t('None'),
  );
  if (isset($settings['colorbox_caption'])) {
    $summary[] = t('Colorbox caption: @type', array(
      '@type' => $caption[$settings['colorbox_caption']],
    ));
  }
  return implode('<br />', $summary);
}