You are here

function template_preprocess_jplayer_view_playlist in jPlayer 6

Same name and namespace in other branches
  1. 7.2 includes/jplayer.theme.inc \template_preprocess_jplayer_view_playlist()

Preprocess function for jplayer.tpl.php when displaying a view as a playlist.

File

includes/jplayer.theme.inc, line 81

Code

function template_preprocess_jplayer_view_playlist(&$vars) {
  if (empty($vars['items'])) {
    return;
  }
  jplayer_add();
  $count = count($vars['items']);
  foreach ($vars['items'] as $number => $item) {
    $classes = array();
    if ($number == 0) {
      $classes[] = 'first';
      $classes[] = 'jplayer_playlist_item_first';
    }
    if ($number == $count - 1) {
      $classes[] = 'last';
      $classes[] = 'jplayer_playlist_item_last';
    }
    $vars['items'][$number]['class'] = implode(' ', $classes);
  }
  $vars['mode'] = 'playlist';
  $vars['player_id'] = _jplayer_check_id('jplayer-view-' . str_replace('_', '-', $vars['view']->name));
}