You are here

function template_preprocess_views_galleriffic_view in Views Galleriffic 6

Same name and namespace in other branches
  1. 7 views_galleriffic.module \template_preprocess_views_galleriffic_view()

Implementation of template preprocess for the view

File

./views_galleriffic.module, line 13

Code

function template_preprocess_views_galleriffic_view(&$vars) {
  $view = $vars['view'];
  $option = $view->style_plugin->options;
  $row = $view->row_plugin->options;
  $vars['option'] = $option;

  // If there is only one result, don't autostart slideshow.
  if (count($view->result) < 2) {
    $option['start'] = FALSE;
  }
  drupal_add_js(array(
    'views_galleriffic' => array(
      'delay' => (int) $option['delay'],
      'transition' => (int) $option['transition'],
      'numbthumbs' => (int) $option['numbthumbs'],
      'enableTopPager' => $option['pager_top'],
      'enableBottomPager' => $option['pager_bottom'],
      'renderSSControls' => $option['renderss'],
      'renderNavControls' => $option['rendernav'],
      'playLinkText' => t("@playtext", array(
        '@playtext' => $option['playtext'],
      )),
      'pauseLinkText' => t("@pausetext", array(
        '@pausetext' => $option['pausetext'],
      )),
      'prevLinkText' => t("@prevlink", array(
        '@prevlink' => $option['prevlink'],
      )),
      'nextLinkText' => t("@nextlink", array(
        '@nextlink' => $option['nextlink'],
      )),
      'nextPageLinkText' => t("@nextpage", array(
        '@nextpage' => $option['nextpage'],
      )),
      'prevPageLinkText' => t("@prevpage", array(
        '@prevpage' => $option['prevpage'],
      )),
      'syncTransitions' => $option['sync'],
      'enableKeyboardNavigation' => $option['keyboard'],
      'enableHistory' => $option['history'],
      'preloadAhead' => $option['preload'],
      'autoStart' => $option['start'],
    ),
  ), 'setting');
  $history_path = drupal_get_path('module', 'views_galleriffic') . '/js/jquery.history.js';
  $path = drupal_get_path('module', 'views_galleriffic');
  if (file_exists($history_path)) {
    drupal_add_js($path . '/js/jquery.history.js');
  }
  drupal_add_js($path . '/js/jquery.galleriffic.js');
  drupal_add_js($path . '/js/views_galleriffic.js');
  drupal_add_js($path . '/js/jquery.opacityrollover.js');
  if ($view->style_plugin->options['css'] == 'true') {
    drupal_add_css(drupal_get_path('module', 'views_galleriffic') . '/css/views_galleriffic_default.css');
  }
}