You are here

function video_field_formatter_settings_summary in Video 7.2

Same name and namespace in other branches
  1. 7 video.field.inc \video_field_formatter_settings_summary()

Implements hook_field_formatter_settings_summary().

File

./video.field.inc, line 1117
Implement a video field, based on the file module's file field.

Code

function video_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.
  switch ($display['type']) {
    case 'video_formatter_thumbnail':
      if (isset($image_styles[$settings['image_style']])) {
        $summary[] = t('Video thumbnail style: @style', array(
          '@style' => $image_styles[$settings['image_style']],
        ));
      }
      else {
        $summary[] = t('Original video thumbnail');
      }
      $link_types = array(
        'content' => t('Linked to content'),
        'file' => t('Linked to video file'),
        'colorbox' => t('Linked to Colorbox overlay'),
      );

      // Display this setting only if image is linked.
      if (isset($link_types[$settings['image_link']])) {
        $summary[] = $link_types[$settings['image_link']];
      }
      break;
    case 'video_formatter_player':
      $summary[] = t('Player dimensions: @widthxheight', array(
        '@widthxheight' => $settings['widthxheight'],
      ));
      if (isset($image_styles[$settings['poster_image_style']])) {
        $summary[] = t('Poster image style: @style', array(
          '@style' => $image_styles[$settings['poster_image_style']],
        ));
      }
      break;
    case 'video_formatter_url':
      $format = !empty($settings['video_extension']) ? t('transcoded ' . strtoupper($settings['video_extension']) . ' file') : 'Original file';
      $summary[] = t('URL to @format', array(
        '@format' => $format,
      ));
      break;
  }
  return implode('<br />', $summary);
}