You are here

function fb_instant_articles_display_field_formatter_settings_summary in Facebook Instant Articles 7.2

Same name and namespace in other branches
  1. 7 modules/fb_instant_articles_display/fb_instant_articles_display.module \fb_instant_articles_display_field_formatter_settings_summary()

Implements hook_field_formatter_settings_summary().

File

modules/fb_instant_articles_display/includes/field.inc, line 239
Field module functionality for Facebook Instant Articles Display module.

Code

function fb_instant_articles_display_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = '';
  switch ($display['type']) {
    case 'fbia_ad_formatter':
      $summary = t('Ad field - set the Source, iFrame height (@height) and width (@width).', array(
        '@height' => $settings['height'],
        '@width' => $settings['width'],
      ));
      break;
    case 'fbia_interactive_formatter':
      $summary = t('Interactive field - set iFrame height (@height) and width (@width).', array(
        '@height' => $settings['height'],
        '@width' => $settings['width'],
      ));
      break;
    case 'fbia_analytics_formatter':
      $summary = t('Analytics field - set the Source of the iframe. (@source)', array(
        '@source' => $settings['source'],
      ));
      break;
    case 'fbia_image_formatter':
      $image_styles = image_style_options(FALSE, PASS_THROUGH);

      // 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['style']])) {
        $summary = t('Image style: @style', array(
          '@style' => $image_styles[$settings['style']],
        ));
      }
      else {
        $summary = t('Original image');
      }
      break;
    case 'fbia_list_formatter':
      $summary = t('List field - Type:(@list_type)', array(
        '@list_type' => $settings['list_type'],
      ));
      break;
  }
  return $summary;
}