You are here

function _views_slideshow_jcarousel_preprocess_views_slideshow_jcarousel_main_frame in Views Slideshow JCarousel 7.2

@file Theme functions for Views Slideshow JCarousel

1 call to _views_slideshow_jcarousel_preprocess_views_slideshow_jcarousel_main_frame()
template_preprocess_views_slideshow_jcarousel_main_frame in ./views_slideshow_jcarousel.module

File

theme/views_slideshow_jcarousel.theme.inc, line 8
Theme functions for Views Slideshow JCarousel

Code

function _views_slideshow_jcarousel_preprocess_views_slideshow_jcarousel_main_frame(&$vars) {
  $settings = $vars['settings'];
  $rows = $vars['rows'];
  $view = $vars['view'];
  $vss_id = $vars['vss_id'];
  $vars['classes_array'][] = 'jcarousel';
  $settings = array_merge(array(
    'num_divs' => sizeof($rows),
    'id_prefix' => '#views_slideshow_jcarousel_main_',
    'div_prefix' => '#views_slideshow_jcarousel_div_',
    'vss_id' => $vss_id,
  ), $settings);
  $slideshow_count = 1;
  if ($slideshow_count > 1) {
    $vss_id .= '-' . $slideshow_count;
    $settings['vss_id'] = $vss_id;
  }

  // Load our cycle css
  drupal_add_js(_views_slideshow_jcarousel_library_path());
  drupal_add_js(drupal_get_path('module', 'views_slideshow_jcarousel') . '/js/views_slideshow_jcarousel.js');
  drupal_add_css(drupal_get_path('module', 'views_slideshow_jcarousel') . '/css/views_slideshow_jcarousel.css');

  //  // Add hover intent library
  //  if ($settings['pause']) {
  //    if (module_exists('libraries')) {
  //      // Load jQuery hoverIntent
  //      $hoverIntent_path = libraries_get_path('jquery.hoverIntent');
  //      if (!empty($hoverIntent_path) && file_exists($hoverIntent_path . '/jquery.hoverIntent.js')) {
  //        drupal_add_js($hoverIntent_path . '/jquery.hoverIntent.js');
  //      }
  //    }
  //  }
  // Add the slideshow elements.
  //  $vars['classes_array'][] = 'views_slideshow_cycle_teaser_section';
  // Retrive the number of items per frame
  if (isset($styles['items_per_slide']) && $styles['items_per_slide'] > 0) {
    $items_per_slide = $styles['items_per_slide'];
  }
  elseif (isset($styles_default['items_per_slide']) && $styles_default['items_per_slide'] > 0) {
    $items_per_slide = $styles_default['items_per_slide'];
  }
  else {
    $items_per_slide = 1;
  }
  $vars['items_per_slide'] = $items_per_slide;
  $items = array();
  $slideshow_count = 0;
  $rendered_rows = '';
  foreach ($rows as $count => $item) {
    $items[] = $item;
    if (count($items) == $items_per_slide || $count == count($rows) - 1) {
      $rendered_rows .= theme(views_theme_functions('views_slideshow_jcarousel_main_frame_row', $vars['view'], $vars['view']->display[$vars['view']->current_display]), array(
        'vss_id' => $vss_id,
        'items' => $items,
        'count' => $slideshow_count,
        'view' => $vars['view'],
      ));
      $items = array();
      $slideshow_count++;
    }
  }
  $vars['rendered_rows'] = $rendered_rows;
}