function theme_jplayer_item_list in jPlayer 7.2
Modified version of theme_item_list().
Parameters
array $variables: Array of variables.
Return value
string Formatted string.
2 theme calls to theme_jplayer_item_list()
- template_preprocess_jplayer in includes/
jplayer.theme.inc - Preprocess function for a player.
- template_preprocess_jplayer_view_playlist in includes/
jplayer.theme.inc - Preprocess function for jplayer.tpl.php when displaying a view as a playlist.
File
- includes/
jplayer.theme.inc, line 58 - Theme and preprocess functions for the jPlayer module.
Code
function theme_jplayer_item_list($variables) {
$items = $variables['items'];
$title = $variables['title'];
$type = $variables['type'];
$attributes = $variables['attributes'];
$output = '';
if (isset($title)) {
$output .= '<h3>' . $title . '</h3>';
}
if (!empty($items)) {
$output .= "<{$type}" . drupal_attributes($attributes) . '>';
$num_items = count($items);
$data = '';
foreach ($items as $i => $item) {
$attributes = array();
$children = array();
if (is_array($item)) {
foreach ($item as $key => $value) {
if ($key == 'data') {
$data = $value;
}
elseif ($key == 'children') {
$children = $value;
}
else {
$attributes[$key] = $value;
}
}
}
else {
$data = $item;
}
if (count($children) > 0) {
// Render nested list.
$data .= theme_item_list(array(
'items' => $children,
'title' => NULL,
'type' => $type,
'attributes' => $attributes,
));
}
if ($i == 0) {
$attributes['class'][] = 'first jp-playlist-first';
}
if ($i == $num_items - 1) {
$attributes['class'][] = 'last jp-playlist-last';
}
$attributes['oncontextmenu'] = "return false;";
$output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
}
$output .= "</{$type}>";
}
return $output;
}