function _global_filter_add_terms in Views Global Filter 6
Same name and namespace in other branches
- 8 global_filter.widgets.inc \_global_filter_add_terms()
- 7 global_filter.widgets.inc \_global_filter_add_terms()
1 call to _global_filter_add_terms()
- global_filter_form in ./
global_filter.module - Creates the drop-down selector for the global selector field.
File
- ./
global_filter.module, line 391 - global_filter.module
Code
function _global_filter_add_terms(&$options, $vocabulary_machine_name, $show_depth = TRUE) {
if (!module_exists('taxonomy')) {
drupal_set_message(t('Global Filter: using vocabulary %vocabulary, but Taxonomy module is not enabled.', array(
'%vocabulary' => $vocabulary_machine_name,
)), 'error');
return;
}
foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
$found = $vocabulary->machine_name == $vocabulary_machine_name;
if ($found) {
break;
}
}
if (empty($found)) {
drupal_set_message(t('Global Filter: the vocabulary %vocabulary does not exist.', array(
'%vocabulary' => $vocabulary_machine_name,
)), 'error');
}
else {
foreach (taxonomy_get_tree($vid) as $term) {
$options[$term->tid] = $show_depth ? str_repeat('-', $term->depth) . $term->name : $term->name;
}
}
}