You are here

function template_preprocess_views_slideshow_thumbnailhover in Views Slideshow 6

Same name and namespace in other branches
  1. 6.2 contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.theme.inc \template_preprocess_views_slideshow_thumbnailhover()

Implement template_preprocess_hook_THEMENAME().

File

contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.theme.inc, line 11
Theme & preprocess functions for the Views Slideshow: ThumbnailHover module.

Code

function template_preprocess_views_slideshow_thumbnailhover(&$vars) {
  $options = $vars['options'];
  $base = drupal_get_path('module', 'views_slideshow_thumbnailhover');
  drupal_add_js($base . '/views_slideshow.js', 'module');
  drupal_add_css($base . '/views_slideshow.css', 'module');
  $hover = 'hover';
  if ($options['hover'] == 'hoverIntent') {
    if (module_exists('jq')) {
      $hover = jq_add('hoverIntent') ? 'hoverIntent' : 'hover';
    }
    else {
      if (module_exists('hoverintent')) {
        $hover = hoverintent_add() ? 'hoverIntent' : 'hover';
      }
    }
  }
  $num_divs = sizeof($vars['rows']);
  $fade = $options['fade'] ? 'true' : 'false';
  $teasers_last = $options['teasers_last'] ? 'true' : 'false';
  $settings = array(
    'num_divs' => $num_divs,
    'timer_delay' => $options['timer_delay'],
    'sort' => intval($options['sort']),
    'fade' => $fade,
    'fade_speed' => $options['fade_speed'],
    'fade_value' => $options['fade_value'],
    'hoverFunction' => $hover,
    'hover_breakout' => $options['hover_breakout'],
    'teasers_last' => $teasers_last,
    'id_prefix' => '#views_slideshow_main_',
    'div_prefix' => '#views_slideshow_div_',
    'id' => $vars['id'],
  );
  drupal_add_js(array(
    'viewsSlideshowSingleFrame' => array(
      '#views_slideshow_main_' . $vars['id'] => $settings,
    ),
  ), 'setting');

  /*  $js = theme('views_slideshow_div_js', $vars['rows'], $vars['options'], $vars['id']);
    drupal_add_js($js, 'inline');*/
}