function global_filter_active_filter_names in Views Global Filter 8
Same name and namespace in other branches
- 7 global_filter.module \global_filter_active_filter_names()
Returns a list of all filter names or only those visible on the current page.
3 calls to global_filter_active_filter_names()
- global_filter_active_filter_names_list in ./
global_filter.module - Return an associative array of all the global filter names.
- global_filter_init in ./
global_filter.module - Implements hook_init().
- global_filter_preprocess in ./
global_filter.module - Implements MODULE_preprocess().
File
- ./
global_filter.module, line 611 - global_filter.module
Code
function global_filter_active_filter_names($visible_only = FALSE) {
$filter_names = array();
if (empty($visible_only)) {
// Find all filters regardless.
foreach (global_filter_get_parameter(NULL) as $key => $filter) {
if (!empty($filter['name'])) {
$filter_names[$key] = $filter['name'];
}
}
}
else {
// Find filters in VISIBLE blocks only.
global $theme;
$all_blocks = array();
// @todo RdB _block_load_blocks();
foreach ($all_blocks as $region => $region_blocks) {
foreach ($region_blocks as $block) {
if ($block->visibility && $block->module == 'global_filter') {
$block_number = drupal_substr($block->delta, -1);
foreach (global_filter_get_filters_for_block($block_number) as $key => $filter) {
if (!in_array($filter['name'], $filter_names)) {
$filter_names[$key] = $filter['name'];
}
}
}
}
}
}
return $filter_names;
}