You are here

function collageformatter_field_formatter_settings_summary in Collage Formatter 7

Implements hook_field_formatter_settings_summary().

File

./collageformatter.module, line 328
Main file for Collage Formatter module.

Code

function collageformatter_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  $summary[] = t('Generate') . ' <strong>' . $settings['collage_number'] . '</strong> ' . t('collage(s)') . ' ' . t('with') . ' <strong>' . ($settings['images_per_collage'] ? $settings['images_per_collage'] : t('all')) . '</strong> ' . t('image(s) per collage') . '; ' . t('Skip') . ' <strong>' . $settings['images_to_skip'] . '</strong> ' . t('image(s) from the start');
  $summary[] = t('Collage orientation') . ': ' . ($settings['collage_orientation'] ? t('Portrait') : t('Landscape'));
  $summary[] = t('Collage width') . ': ' . ($settings['collage_width'] ? $settings['collage_width'] . 'px' : t('Not set'));
  $summary[] = t('Collage height') . ': ' . ($settings['collage_height'] ? $settings['collage_height'] . 'px' : t('Not set'));
  $summary[] = t('Collage border') . ': ' . $settings['collage_border_size'] . 'px <span style="background-color: ' . $settings['collage_border_color'] . ';">' . $settings['collage_border_color'] . '</span>';
  $summary[] = t('Image gap') . ': ' . $settings['gap_size'] . 'px <span style="background-color: ' . $settings['gap_color'] . ';">' . $settings['gap_color'] . '</span>';
  $summary[] = t('Image border') . ': ' . $settings['border_size'] . 'px <span style="background-color: ' . $settings['border_color'] . ';">' . $settings['border_color'] . '</span>';
  $link_types = array(
    'content' => t('Images linked to content'),
    'file' => t('Images linked to file'),
  );
  if (isset($link_types[$settings['image_link']])) {
    $summary[] = $link_types[$settings['image_link']];
    if ($settings['image_link'] == 'file') {
      if (empty($settings['image_link_image_style'])) {
        $summary[] = t('Target image style') . ': ' . t('None (original image)');
      }
      else {
        $image_styles = image_style_options(FALSE);
        $summary[] = t('Target image style') . ': ' . $image_styles[$settings['image_link_image_style']];
      }

      // Modal gallery summary.
      if (empty($settings['image_link_modal'])) {
        $summary[] = t('Modal gallery') . ': ' . t('None');
      }
      else {
        $summary[] = t('Modal gallery') . ': ' . $settings['image_link_modal'];
      }

      // Custom class/rel summary.
      $custom = array();
      if (!empty($settings['image_link_class'])) {
        $custom[] = 'class="' . check_plain($settings['image_link_class']) . '"';
      }
      if (!empty($settings['image_link_rel'])) {
        $custom[] = 'rel="' . check_plain($settings['image_link_rel']) . '"';
      }
      $summary[] = implode(' ', $custom);
    }
  }
  else {
    $summary[] = t('Images without links');
  }
  if ($settings['generate_image_derivatives']) {
    $summary[] = t('Generate image derivatives');
  }
  else {
    $summary[] = t('Do not generate image derivatives');
  }
  if ($settings['prevent_upscale']) {
    $summary[] = t('Prevent images upscaling');
  }
  return implode('<br />', $summary);
}