Active
Project:
Views carousel
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Sep 2010 at 16:32 UTC
Updated:
27 Nov 2010 at 06:07 UTC
function theme_jcarousel($items = array(), $options = array(), $skin = 'tango', $skin_path = NULL, $id = 'jcarousel') {
$name = form_clean_id($id);
jcarousel_add('#'. $name, $options, $skin, $skin_path);
$output = '<ul id="'. $name .'" class="js-hide jcarousel-skin-'. $skin .'">';
foreach ($items as $item) {
$output .= '<li>'. $item .'</li>';
}
$output .= '</ul>';
return $output;
}
should perform a check before attempting to render:
function theme_jcarousel($items = array(), $options = array(), $skin = 'tango', $skin_path = NULL, $id = 'jcarousel') {
if ($items[0]) {
$name = form_clean_id($id);
jcarousel_add('#'. $name, $options, $skin, $skin_path);
$output = '<ul id="'. $name .'" class="js-hide jcarousel-skin-'. $skin .'">';
foreach ($items as $item) {
$output .= '<li>'. $item .'</li>';
}
$output .= '</ul>';
return $output;
}
}
Comments
Comment #1
quicksketchI don't particularly agree with this change. It's possible that you'd actually want an empty
<ul>added to the page in the situation that you were loading these items through JavaScript earlier in the page load. If we're having a problem of calling this with an empty list of items, we should do the check prior to calling theme('jcarousel').Comment #2
quicksketchMoving this to Views Carousel, since it's the module rendering the empty carousel incorrectly.
Comment #3
digitalfrontiersmediaAgreed. Good call.