You are here

function textimage_field_formatter_settings_summary in Textimage 7.3

Implements hook_field_formatter_settings_summary().

File

./textimage.module, line 505
Textimage - Provides text to image manipulations.

Code

function textimage_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  $image_styles = TextimageStyles::getOptions(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_style']])) {
    $summary[] = t('Image style: @style', array(
      '@style' => $image_styles[$settings['image_style']],
    ));
  }
  else {
    $summary[] = t('Image style: undefined');
  }

  // Multi-value text field image generation settings.
  if ($field['module'] == 'text' && $field['cardinality'] != 1) {
    $options = array(
      'merge' => t("Build one image"),
      'itemize' => t("Build multiple images"),
    );
    $summary[] = t('Multiple text values:') . ' ' . $options[$settings['image_text_values']];
  }

  // Display link setting only if image is linked.
  $link_types = array(
    'content' => t('Linked to content'),
    'file' => t('Linked to file'),
  );
  if (isset($link_types[$settings['image_link']])) {
    $summary[] = $link_types[$settings['image_link']];
  }

  // Display this setting only if alt text is specified.
  if (!empty($settings['image_alt'])) {
    $summary[] = t('Alternate text: @image_alt', array(
      '@image_alt' => $settings['image_alt'],
    ));
  }

  // Display this setting only if title is specified.
  if (!empty($settings['image_title'])) {
    $summary[] = t('Title: @image_title', array(
      '@image_title' => $settings['image_title'],
    ));
  }
  return implode('<br />', $summary);
}