You are here

function jw_player_field_formatter_settings_summary in JW Player 7

Same name and namespace in other branches
  1. 7.2 jw_player.module \jw_player_field_formatter_settings_summary()

Implements hook_field_formatter_settings_summary().

File

./jw_player.module, line 128
Adds a theme function which allows theme developers to use the JW Player.

Code

function jw_player_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  $presets = jw_player_preset_load();
  if (isset($presets[$settings['jwplayer_preset']])) {
    $summary[] = t('Preset: @name', array(
      '@name' => $presets[$settings['jwplayer_preset']]['preset_name'],
    ));
    $summary[] = t('Description: @description', array(
      '@description' => $presets[$settings['jwplayer_preset']]['description'],
    ));
    $settings = $presets[$settings['jwplayer_preset']]['settings'];
    foreach ($settings as $key => $val) {

      // Filter out complex settings in the form of arrays (such as plugins).
      // @todo Tackle the display of enabled plugins separately.
      if (!is_array($val)) {
        $summary[] = t('@key: @val', array(
          '@key' => $key,
          '@val' => !empty($val) ? $val : t('default'),
        ));
      }
    }
  }
  else {
    $summary[] = t('No preset selected');
  }
  return implode('<br />', $summary);
}