You are here

function exposed_filter_data_preprocess_exposed_filter_data in Exposed Filter Data 6

Same name and namespace in other branches
  1. 7 exposed_filter_data.module \exposed_filter_data_preprocess_exposed_filter_data()

Implementation of hook_preprocess().

File

./exposed_filter_data.module, line 25
Provides simple way to print exposed filter data

Code

function exposed_filter_data_preprocess_exposed_filter_data(&$vars) {

  // Add the CSS
  drupal_add_css(drupal_get_path('module', 'exposed_filter_data') . '/exposed_filter_data.css');
  $view = $vars['view'];

  // In case no view - get the current view
  if ($view == NULL) {
    $view = views_get_current_view();
  }

  // Make a variable out of each filter
  if (isset($view->exposed_input)) {
    foreach ($view->exposed_input as $filter => $value) {
      $vars[$filter] = $value;
      if (is_array($value)) {
        $vars['exposed_filters'][$filter] = check_plain(implode(", ", $value));
      }
      else {
        $vars['exposed_filters'][$filter] = check_plain($value);
      }
    }
  }
}