You are here

function template_preprocess_views_view_accordion in Views Accordion 7

Same name and namespace in other branches
  1. 6 views_accordion.module \template_preprocess_views_view_accordion()

Template function for views_accordion style plugin.

Parameters

array $vars: Array of template variables.

The JS file is loaded within render() in views_accordion_style_plugin.inc

File

./views_accordion.module, line 58
Provide an accordion display style for Views.

Code

function template_preprocess_views_view_accordion(&$vars) {

  // Inherit the normal unformatted classes.
  template_preprocess_views_view_unformatted($vars);
  $vars['use_group_header'] = $vars['options']['use-grouping-header'];

  // The template variable 'view_accordion_id' MUST be the same as $accordion_id
  // in the render() function inside the style plugin.
  // Don't touch it or it will stop working.
  $vars['view_accordion_id'] = 'views-accordion-' . $vars['view']->name . '-' . $vars['view']->current_display . '-header';

  // Add the css for fixing/preventing accordion issues.
  drupal_add_css(drupal_get_path('module', 'views_accordion') . '/views-accordion.css');
}