You are here

function photobox_field_formatter_settings_summary in PhotoboxPhotobox 7

Implements hook_field_formatter_settings_summary().

File

./photobox.module, line 180
Main file for the Photobox module.

Code

function photobox_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['photobox_content_image_style']])) {
    $summary[] = t('Content image style: @style', array(
      '@style' => $image_styles[$settings['photobox_content_image_style']],
    ));
  }
  else {
    $summary[] = t('Content image style: @style', array(
      '@style' => t('Original image'),
    ));
  }
  if (isset($image_styles[$settings['photobox_content_image_style_first']])) {
    $summary[] = t('Content image style for first image: @style', array(
      '@style' => $image_styles[$settings['photobox_content_image_style_first']],
    ));
  }
  else {
    $summary[] = t('Content image style: @style', array(
      '@style' => t('Original image'),
    ));
  }
  if (isset($image_styles[$settings['photobox_image_style']])) {
    $summary[] = t('Photobox image style: @style', array(
      '@style' => $image_styles[$settings['photobox_image_style']],
    ));
  }
  else {
    $summary[] = t('Photobox image style: @style', array(
      '@style' => t('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['photobox_gallery'])) {
    $summary[] = t('Photobox gallery type: @type', array(
      '@type' => $gallery[$settings['photobox_gallery']],
    )) . ($settings['photobox_gallery'] == 'custom' ? ' (' . $settings['photobox_gallery_custom'] . ')' : '');
  }
  $caption = array(
    'auto' => t('Automatic'),
    'title' => t('Title text'),
    'alt' => t('Alt text'),
    'content_title' => t('Content title'),
    'custom' => t('Custom (with tokens)'),
    'none' => t('None'),
  );
  if (isset($settings['photobox_caption'])) {
    $summary[] = t('Photobox caption: @type', array(
      '@type' => $caption[$settings['photobox_caption']],
    ));
  }
  return implode('<br />', $summary);
}