You are here

function photoswipe_field_formatter_settings_summary in PhotoSwipe 7

Same name and namespace in other branches
  1. 7.2 photoswipe.module \photoswipe_field_formatter_settings_summary()

Implements hook_field_formatter_settings_summary().

File

./photoswipe.module, line 144
Photswipe integration with Drupal module.

Code

function photoswipe_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['photoswipe_node_style']])) {
    $summary[] = t('Node image style: @style', array(
      '@style' => $image_styles[$settings['photoswipe_node_style']],
    ));
  }
  else {
    if ($settings['photoswipe_node_style'] == 'hide') {
      $summary[] = t('Node image style: Hide');
    }
    else {
      $summary[] = t('Node image style: Original image');
    }
  }
  if (isset($image_styles[$settings['photoswipe_image_style']])) {
    $summary[] = t('Photoswipe image style: @style', array(
      '@style' => $image_styles[$settings['photoswipe_image_style']],
    ));
  }
  else {
    $summary[] = t('photoswipe image style: Original image');
  }
  return implode('<br />', $summary);
}