Same name and namespace in other branches
  1. 5.0.x views_slideshow.theme.inc \template_preprocess_views_slideshow_pager_fields()
  2. 8.x-3.x views_slideshow.theme.inc \template_preprocess_views_slideshow_pager_fields()
  3. 8.x-4.x views_slideshow.theme.inc \template_preprocess_views_slideshow_pager_fields()

Theme pager fields.

Paramètres

array $vars: Theme variables.

Sujets associés

1 call to template_preprocess_views_slideshow_pager_fields()
_views_slideshow_preprocess_views_slideshow_pager_fields dans theme/views_slideshow.theme.inc
Backwards compatibility wrapper.

Fichier

theme/views_slideshow.theme.inc, line 257

Code

function template_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_library('views_slideshow', 'views_slideshow');
    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');
            }
        }
    }
    $vars['classes_array'][] = $vars['attributes']['class'];
    $vars['widget_id'] = $vars['attributes']['id'];
    // Add our class to the wrapper.
    $vars['classes_array'][] = '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.
    $items_per_slide = isset($vars['view']->style_options['views_slideshow_cycle']['items_per_slide']) ? $vars['view']->style_options['views_slideshow_cycle']['items_per_slide'] : null;
    $vars['rendered_field_items'] = '';
    if (empty($vars['settings']['hide_on_single_slide']) || count($vars['view']->result) > $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]), array(
                        'view' => $vars['view'],
                        'field' => $field,
                        'count' => $count,
                    ));
                }
            }
            $vars['rendered_field_items'] .= theme(views_theme_functions('views_slideshow_pager_field_item', $vars['view'], $vars['view']->display[$vars['view']->current_display]), array(
                'vss_id' => $vars['vss_id'],
                'item' => $rendered_fields,
                'count' => $count,
                'location' => $vars['location'],
                'length' => count($vars['view']->result),
            ));
        }
    }
}