' . 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('Row style must be set to Fields.') . '
';
$output .= '- ' . t('The header field can not be set to inline.') . '
';
$output .= '- ' . t('If you use a separator for inline fields, be sure to wrap it in a html tag, like a span tag.') . '
';
$output .= '
';
$output .= '' . t('Choose Views Accordion in the Style dialog within your view, which will prompt you to configure:') . '
';
$output .= '';
$output .= '- ' . t('Transition time: How fast you want the opening and closing of the sections to last for, in seconds. Default is half a second.') . '
';
$output .= '- ' . t('Start with the first row opened: Wether or not the first row of the view should start opened when the view is first shown. Uncheck this if you would like the accordion to start closed.') . '
';
$output .= '- ' . t("Use the module's default styling: If you disable this, the CSS file in the module's directory (views-accordion.css) will not be loaded. You can uncheck this if you plan on doing your own CSS styling.") . '
';
$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 .= '- ' . t('views-acordion.css - with how the classes the author thought would be best used, mostly empty.') . '
';
$output .= '- ' . t('views-view-accordion.tpl.php - copy/paste into your theme directory - please the comments in this file for requirements/instructions.') . '
';
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;
}