Commit 4663a33c authored by Nesta Campbell's avatar Nesta Campbell
Browse files

Fixed minor bug where taxonomy form was showing up even when no categories

had been created.
parent d467fe90
...@@ -95,34 +95,35 @@ function search_config_form_alter($form_id, &$form) { ...@@ -95,34 +95,35 @@ function search_config_form_alter($form_id, &$form) {
} }
} }
// Taxonomy if ($taxonomy = module_invoke('taxonomy', 'form_all', 1)) {
if (variable_get('search_config_disable_category_all', 0) || !user_access('search by category')) { // Taxonomy
unset($form['advanced']['category']); if (variable_get('search_config_disable_category_all', 0) || !user_access('search by category')) {
} unset($form['advanced']['category']);
else { }
$terms = variable_get('search_config_disable_category', array()); else {
$taxonomy = module_invoke('taxonomy', 'form_all', 1); $terms = variable_get('search_config_disable_category', array());
// FIXME: What about multiple hierarchy categories? // FIXME: What about multiple hierarchy categories?
foreach ($taxonomy as $vocab => $term) { foreach ($taxonomy as $vocab => $term) {
foreach ($term as $k => $v) { foreach ($term as $k => $v) {
if(in_array($k, $terms)) { if(in_array($k, $terms)) {
unset($taxonomy[$vocab][$k]); unset($taxonomy[$vocab][$k]);
}
} }
} }
}
// Taxonomy box: // Taxonomy box:
$form['advanced']['category'] = array( $form['advanced']['category'] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Only in the category(s)'), '#title' => t('Only in the category(s)'),
'#prefix' => '<div class="criterion">', '#prefix' => '<div class="criterion">',
'#size' => 10, '#size' => 10,
'#suffix' => '</div>', '#suffix' => '</div>',
'#options' => $taxonomy, '#options' => $taxonomy,
'#multiple' => TRUE, '#multiple' => TRUE,
); );
}
} }
} }
break; break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment