To get both filter name and its value, you can do something like that :
Make a variable out of each filter
function MODULE_preprocess_exposed_filter_data(&$vars) {
$view = $vars['view'];
// In case no view - get the current view
if ($view == NULL) {
$view = views_get_current_view();
}
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);
}
}
}
}
Declare your template
function MODULE_theme() {
return array(
'exposed_filter_data' => array(
'template' => 'exposed_filter_data',
'variables' => array(
'view' => NULL,
),
),
);
}
Call to template output
function get_exposed_filter_output() {
return theme('exposed_filter_data');
}
In exposed_filter_data.tpl.php
file
<?php if (isset($exposed_filters)): ?>
<div class="exposed_filter_data">
<div class="title"><?php print t('Filtered by:'); ?></div>
<div class="content">
<?php foreach ($exposed_filters as $filter => $value):
//Do stuff with your filters and values here ?>
<?php if ($value): ?>
//taxonomy terms for instance
if ($filter == 'field_taxonomy_tid') :
if($value != '' && $value != 'All' ){
$term = taxonomy_term_load($tid);
$vocab = taxonomy_vocabulary_load($term->vid);
$vocab_name = $vocab->name; ?>
<div class="filter">
<div class="name">$vocab_name :</div>
<div class="value">
<?php $types = explode(',', $value);
$t = taxonomy_term_load_multiple ($types);
$exp_types = '';
foreach ($t as $k=>$v) {
$exp_types .= $v-> name . ', ';
}
$exp_types = substr($exp_types, 0, -2);
print $exp_types;
?>
</div>
</div>
<?php }
endif;
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
Finally print your exposed filter data : instead of using global PHP in your view, you'd better try something like that :
function MODULE_views_pre_render(&$view) {
if ( $view->name == 'MYVIEWNAME' ){
//display exposed filters in a custom text area
if (isset($view->header['area_text_custom'])){
$exp = get_exposed_filter_output();
$view->header['area_text_custom']->options['content'] = $exp;
}
}
}
This is 80% inspired by this little handy module : Exposed Filter Data