In drupal 7, I'm trying to remove an exposed taxonomy filter. This taxonomy filter has a depth of 2. I'm only trying to expose the parent item.
As a quick fix I'm trying (poorly) to remove them with the following theme function below.
<?php
function theme_preprocess_views_exposed_form(&$vars, $hook) {
// views-exposed-form-instructor-profile-list-page
switch($vars['form']['#id']) {
// instructor profile
case 'views-exposed-form-instructor-profile-list-page':
foreach ($vars['form']['term_node_tid_depth']['#options'] as $option) {
foreach ($option->option as $key=>$v) {
if (stristr($v, '-')) {
print $v . '<br>';
$vars['form']['term_node_tid_depth']['#options']['option'][$key] = 'FILTERED';
}
}
}
print_r($vars['form']['term_node_tid_depth']['#options']['option']);
break;
// do nothing
default:
}
}
In the end I'm trying to figure out what exactly to unset()
any option that begins with '- child item
'.