From 44df3b237d92ae7194315f28acc6a2cab4e02d85 Mon Sep 17 00:00:00 2001
From: Matt G <madmatter23@gmail.com>
Date: Fri, 22 Jul 2011 12:57:28 -0500
Subject: [PATCH] added function that permits hidden vocabularies to also be hidden on advanced search page

---
 taxonomy_hide.admin.inc |    8 ++++++++
 taxonomy_hide.module    |   16 ++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 taxonomy_hide.admin.inc
 mode change 100644 => 100755 taxonomy_hide.module

diff --git a/taxonomy_hide.admin.inc b/taxonomy_hide.admin.inc
old mode 100644
new mode 100755
index 729cc10..bc53626
--- a/taxonomy_hide.admin.inc
+++ b/taxonomy_hide.admin.inc
@@ -14,6 +14,14 @@ function _taxonomy_hide_admin_settings() {
     '#default_value'  => variable_get('taxonomy_hide_group_by_vocabulary', 0),
     '#description'    => t('Check this box to group terms by vocabulary in node views.'),
   );
+
+  $form['taxonomy_hide_advanced_search'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('Hide on Advanced Search'),
+    '#default_value'  => variable_get('taxonomy_hide_advanced_search', 0),
+    '#description'    => t('Check this box to hide selected vocabularies on the core Advanced Search page.'),
+  );
+
   $form['taxonomy_hide'] = array(
     '#type'           => 'fieldset',
     '#title'          => t('Vocabulary settings'),
diff --git a/taxonomy_hide.module b/taxonomy_hide.module
old mode 100644
new mode 100755
index 81dc45a..d915a0f
--- a/taxonomy_hide.module
+++ b/taxonomy_hide.module
@@ -1,4 +1,5 @@
 <?php
+// $Id: taxonomy_hide.module,v 1.9.4.4 2008/10/27 23:35:52 brmassa Exp $
 
 /**
  * @file
@@ -50,3 +51,18 @@ function taxonomy_hide_nodeapi(&$node, $op, $arg = 0, $arg2 = 0) {
   }
   return;
 }
+
+/**
+* Implementation of hook_form_alter()
+*/
+
+function taxonomy_hide_form_alter(&$form, $form_state, $form_id){
+  if ('search_form' == $form_id && variable_get('taxonomy_hide_advanced_search', 0) === 1) {
+    $voc = taxonomy_get_vocabularies();
+    $hvoc = variable_get('taxonomy_hide_vocabularies', array());
+
+    foreach ($hvoc as $vid)
+      unset($form['advanced']['category']['#options'][$voc[$vid]->name]);
+  }
+  return $form;
+}
-- 
1.7.1

