You are here

function template_preprocess_jplayer_view_playlist in jPlayer 7.2

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

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

Parameters

array $vars: Variable array.

File

includes/jplayer.theme.inc, line 277
Theme and preprocess functions for the jPlayer module.

Code

function template_preprocess_jplayer_view_playlist(&$vars) {
  $view = $vars['view'];
  $vars['settings'] = $view->style_plugin->options;
  $vars['mode'] = 'playlist';
  $vars['player_id'] = _jplayer_check_id('jplayer-view-' . str_replace('_', '-', check_plain($view->name)));
  $player = jplayer_sort_files($vars['items'], $vars['player_id'], $vars['mode']);
  $vars['playlist'] = theme('jplayer_item_list', array(
    'items' => $player['playlist'],
  ));
  $vars['type'] = $player['type'];

  // Add player settings.
  $player = array(
    'jplayerInstances' => array(
      $vars['player_id'] => array(
        'files' => $player['files'],
        'solution' => $vars['settings']['solution'],
        'supplied' => $player['extensions'],
        'preload' => $vars['settings']['preload'],
        'volume' => $vars['settings']['volume'] / 100,
        'muted' => (bool) $vars['settings']['muted'],
        'autoplay' => (bool) $vars['settings']['autoplay'],
        'repeat' => $vars['settings']['repeat'],
        'backgroundColor' => $vars['settings']['backgroundColor'],
        'continuous' => $vars['settings']['continuous'],
      ),
    ),
  );
  drupal_add_js($player, 'setting');
  $vars['dynamic'] = _jplayer_js_attach();
}