function template_preprocess_views_galleriffic_view in Views Galleriffic 7
Same name and namespace in other branches
- 6 views_galleriffic.module \template_preprocess_views_galleriffic_view()
Implements template preprocess for the view.:
File
- ./
views_galleriffic.module, line 20 - Views Galleriffic module file.
Code
function template_preprocess_views_galleriffic_view(&$vars) {
$view = $vars['view'];
$option = $view->style_plugin->options;
$vars['option'] = $option;
// If there is only one result, set transition to 0.
if (count($view->result) < 2) {
$option['autostart'] = FALSE;
}
// The thumbnails above looks better without the pagers.
if ($option['css'] == 'above') {
$option['pager_top'] = FALSE;
$option['pager_bottom'] = FALSE;
}
drupal_add_js(array(
'views_galleriffic' => array(
'delay' => (int) $option['delay'],
'preloadAhead' => $option['preload'],
'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'],
'autoStart' => $option['start'],
),
), 'setting');
$path = drupal_get_path('module', 'views_galleriffic');
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 ($option['history'] == 'true' && module_exists('libraries')) {
$libraries = libraries_get_libraries();
// Libraries 1.x only checks if directory exits.
if ($libraries && !empty($libraries['history']) && file_exists($libraries['history'] . '/jquery.history.js')) {
drupal_add_js($libraries['history'] . '/jquery.history.js');
}
else {
drupal_set_message(t('History plugin not properly installed.'));
}
}
if ($option['css']) {
// Preserve legacy setting of 'true' which is now the default stylesheet.
$option['css'] = $option['css'] == 'true' ? 'default' : $option['css'];
drupal_add_css($path . '/css/views_galleriffic_' . $option['css'] . '.css', $options = array(
'type' => 'file',
));
}
}