You are here

function lightgallery_field_formatter_settings_summary in Lightgallery 7

Implements hook_field_formatter_settings_summary().

File

includes/lightgallery.field.inc, line 229
Contains all hooks and related methods for the lightgallery_formatter field formatter.

Code

function lightgallery_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['image_styles']['lightgallery_image_style']])) {
    $summary[] = t('Lightgallery image style: @style', array(
      '@style' => $image_styles[$settings['image_styles']['lightgallery_image_style']],
    ));
  }
  else {
    $summary[] = t('Lightgallery image style: Original image');
  }
  if (isset($image_styles[$settings['image_styles']['lightgallery_image_thumb_style']])) {
    $summary[] = t('Content image style: @style', array(
      '@style' => $image_styles[$settings['image_styles']['lightgallery_image_thumb_style']],
    ));
  }
  else {
    $summary[] = t('Content image style: Original image');
  }
  $summary[] = $settings['lightgallery_thumbs']['thumbnails'] ? t('Use thumbs in gallery: Yes') : t('Use thumbs in gallery: No');
  return implode('<br />', $summary);
}