You are here

function hosting_site_preprocess_views_view in Hosting 7.3

Same name and namespace in other branches
  1. 7.4 site/includes/views/hosting_site.views.inc \hosting_site_preprocess_views_view()

Implements hook_preprocess_views_view().

File

site/includes/views/hosting_site.views.inc, line 307
Hosting site views integration.

Code

function hosting_site_preprocess_views_view(&$vars) {
  if ($vars['view']->name == 'hosting_site_list') {

    // Wrap exposed filters in a fieldset.
    if ($vars['exposed']) {

      // Ensure required css and js libs are added
      drupal_add_js('misc/form.js');
      drupal_add_js('misc/collapse.js');

      // Assume other get vars are exposed filters, so expand fieldset
      // to show applied filters
      $class = array(
        'collapsible',
        'collapsed',
      );
      if (count($_GET) > 1) {
        $class = array(
          'collapsible',
        );
      }

      // Build fieldset element, using correct array nesting for theme_fieldset
      $fieldset['element'] = array(
        '#title' => t('Filters'),
        '#attributes' => array(
          'class' => $class,
        ),
        '#value' => $vars['exposed'],
        '#children' => '',
      );

      // Reassign exposed filter tpl var to fieldset value
      $vars['exposed'] = theme('fieldset', $fieldset);
    }
  }
}