' . t('The Views Accordion module is a Views style plugin that displays the results in a JQuery accordion style. For more updated information visit the !views_accordion_documentation_page.', array('!views_accordion_documentation_page' => l(t('Views Accordion documentation page'), 'http://drupal.org/node/366263', array('absolute' => TRUE)))) . '

'; $output .= '

' . t('How to use the plugin') . '

'; $output .= t('IMPORTANT: The first field in order of appearance will be the one used as the "header" or "trigger" of the accordion action.') . '
'; $output .= '

' . t('Your view must meet these requirements:') . '

'; $output .= ''; $output .= '

' . t('Choose Views Accordion in the Style dialog within your view, which will prompt you to configure:') . '

'; $output .= ''; $output .= '

' . t('Theming information') . '

'; $output .= t('This module comes with a default style, which you can disable in the options (see above). Files included for your convinence:'); $output .= ''; return $output; } } /** * Implements hook_views_api(). */ function views_accordion_views_api() { return array('api' => 2); } /** * Template function for views_accordion style plugin. * * @param array $vars * Array of template variables. * * The JS file is loaded within render() in views_accordion_style_plugin.inc */ 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'); } /** * Only returns true the first time it's called for an id. * * @param string $id * A unique view id. * * @return bool * TRUE for the first time called for a given $id * FALSE for each time after that */ function theme_views_accordion_display_item($id) { static $display = array(); if (!isset($display[$id])) { $display[$id] = FALSE; } $output = $display[$id]; if ($display[$id] == FALSE) { $display[$id] = TRUE; } return $output; }