function _views_slideshow_preprocess_views_slideshow_pager_fields in Views Slideshow 6.3
Same name and namespace in other branches
- 7.3 theme/views_slideshow.theme.inc \_views_slideshow_preprocess_views_slideshow_pager_fields()
Theme pager fields
1 call to _views_slideshow_preprocess_views_slideshow_pager_fields()
File
- theme/
views_slideshow.theme.inc, line 227 - The theme system, which controls the output of views slideshow.
Code
function _views_slideshow_preprocess_views_slideshow_pager_fields(&$vars) {
// Build our javascript settings.
$js_vars = array(
'viewsSlideshowPagerFields' => array(
$vars['vss_id'] => array(
$vars['location'] => array(
'activatePauseOnHover' => $vars['settings']['views_slideshow_pager_fields_hover'],
),
),
),
);
// Add the settings to the page.
drupal_add_js($js_vars, 'setting');
// Add hover intent library
if ($vars['settings']['views_slideshow_pager_fields_hover']) {
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 our class to the wrapper.
$vars['attributes']['class'] = isset($vars['attributes']['class']) ? $vars['attributes']['class'] . ' views_slideshow_pager_field' : 'views_slideshow_pager_field';
// Render all the fields unless there is only 1 slide and the user specified
// to hide them when there is only one slide.
$vars['rendered_field_items'] = '';
if (empty($vars['settings']['hide_on_single_slide']) || count($vars['view']->result) > $vars['view']->style_options['views_slideshow_cycle']['items_per_slide']) {
foreach ($vars['view']->result as $count => $node) {
$rendered_fields = '';
foreach ($vars['settings']['views_slideshow_pager_fields_fields'] as $field => $use) {
if ($use !== 0 && is_object($vars['view']->field[$field])) {
$rendered_fields .= theme(views_theme_functions('views_slideshow_pager_field_field', $vars['view'], $vars['view']->display[$vars['view']->current_display]), $vars['view'], $field, $count);
}
}
$vars['rendered_field_items'] .= theme(views_theme_functions('views_slideshow_pager_field_item', $vars['view'], $vars['view']->display[$vars['view']->current_display]), $vars['vss_id'], $rendered_fields, $count, $vars['location'], count($vars['view']->result));
}
}
}