You are here

function theme_views_slideshow_slideshow in Views Slideshow 5

Display the slideshow items in a div w/ jquery

2 theme calls to theme_views_slideshow_slideshow()
theme_views_slideshow_view_list in ./views_slideshow.module
Display the nodes of a view as a list.
theme_views_slideshow_view_nodes in ./views_slideshow.module
Display the nodes of a view as plain nodes.

File

./views_slideshow.module, line 274

Code

function theme_views_slideshow_slideshow($view, $nodes, $type, $items) {
  static $div = 0;
  static $added_js = FALSE;
  $output = '';
  if (is_array($items) && !empty($items)) {
    $mode = isset($view->slideshow['mode']) ? $view->slideshow['mode'] : variable_get('views_slideshow_default_mode', VIEWS_SLIDESHOW_DEFAULT_MODE);
    if ($mode == VIEWS_SLIDESHOW_MODE_JCAROUSEL) {
      $skin = isset($view->slideshow['skin']) ? $view->slideshow['skin'] : variable_get('views_slideshow_jcarousel_skin', VIEWS_SLIDESHOW_JCAROUSEL_SKIN_DEFAULT);
      jcarousel_add($skin);
    }
    else {
      if (!$added_js) {
        $base = drupal_get_path('module', 'views_slideshow');
        drupal_add_js($base . '/js/views_slideshow.js', 'module');
        drupal_add_css($base . '/views_slideshow.css', 'module');
        $added_js = TRUE;
      }
    }
    $div++;
    if ($mode == VIEWS_SLIDESHOW_MODE_JCAROUSEL) {
      $js = theme('views_slideshow_jcarousel_js', $div);
    }
    else {
      $js = theme('views_slideshow_div_js', $view, $nodes, $type, $items, $div);
    }
    drupal_add_js($js, 'inline');
    $hover_breakout = isset($view->slideshow['hover_breakout']) ? $view->slideshow['hover_breakout'] : variable_get('views_slideshow_default_hover_breakout', VIEWS_SLIDESHOW_DEFAULT_HOVER_BREAKOUT);
    $teaser = $hover_breakout == VIEWS_SLIDESHOW_HOVER_BREAKOUT_TEASER ? TRUE : FALSE;

    // if we're using the 'thumbnail hover' mode, then we need to display all the view thumbnails
    if ($mode == VIEWS_SLIDESHOW_MODE_THUMBNAIL_HOVER) {
      $view_teasers = theme('views_slideshow_breakout_teasers', $view, $nodes, $type, $items, $div);
      $teasers_last = isset($view->slideshow['teasers_last']) ? $view->slideshow['teasers_last'] : variable_get('views_slideshow_default_teasers_last', VIEWS_SLIDESHOW_DEFAULT_TEASERS_LAST);
      if (!$teasers_last) {
        $output .= $view_teasers;
      }
    }

    // these are hidden elements, used to cycle through the main div
    if ($mode != VIEWS_SLIDESHOW_MODE_JCAROUSEL) {
      $hidden_elements .= theme('views_slideshow_no_display_section', $view, $nodes, $type, $items, $div, $mode, $teaser);
    }
    if ($mode == VIEWS_SLIDESHOW_MODE_THUMBNAIL_HOVER) {
      $output .= theme('views_slideshow_main_section', $view, $nodes, $type, $items, node_view(node_load($nodes[0]->nid), $teaser, FALSE, FALSE), $div, $hidden_elements);
    }
    else {
      if ($mode == VIEWS_SLIDESHOW_MODE_JCAROUSEL) {
        $output .= theme('views_slideshow_jcarousel', $items, $div, $skin);
      }
      else {
        $output .= theme('views_slideshow_main_section', $view, $nodes, $type, $items, $items[0], $div, $hidden_elements);
      }
    }
    if ($view_teasers && $teasers_last) {
      $output .= $view_teasers;
    }
  }
  return $output;
}