? menutrails-690068.patch
Index: menutrails.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/menutrails/menutrails.module,v
retrieving revision 1.4.2.24
diff -u -p -r1.4.2.24 menutrails.module
--- menutrails.module	16 Mar 2010 21:18:49 -0000	1.4.2.24
+++ menutrails.module	30 May 2010 18:58:37 -0000
@@ -60,6 +60,30 @@ function menutrails_enable() {
 }
 
 /**
+ * Implementation of hook_form_ID_alter().
+ * 
+ * This adds a checkbox to vocabularies editing form to enable menu trails.
+ */
+function menutrails_form_taxonomy_form_vocabulary_alter(&$form, &$form_state) {
+  $vid = $form['vid']['#value'];
+  $form['settings']['use_menutrails'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use this vocabulary to set menu trails'),
+    '#default_value' => variable_get("menutrails_vocabulary_$vid", 0),
+    '#description' => t('Warning: using vocabularies with a large set of terms may cause php out of memory errors.'),
+  );
+  $form['#submit'][] = 'menutrails_form_vocabulary_submit';
+}
+
+/**
+ * Additional submit handler for vocabulary form to store menutrails settings.
+ */
+function menutrails_form_vocabulary_submit($form, &$form_state) {
+  $vid = $form_state['values']['vid'];
+  variable_set("menutrails_vocabulary_$vid", $form_state['values']['use_menutrails']);
+}
+
+/**
  * Implementation of hook_nodeapi().
  *
  * This will evaluate individual nodes when being viewed and take the necessary
@@ -265,7 +289,7 @@ function menutrails_menutrails_settings(
   }
   foreach ($vocabs as $vocab) {
     // Tagging gets out of hand too fast, so we disallow.
-    if ($vocab->tags != 1) {
+    if (variable_get('menutrails_vocabulary_'.$vocab->vid, 0) && ($vocab->tags != 1)) {
       $form[$vocab->vid]['menutrails_terms'] = array(
         '#tree' => TRUE,
         '#type' => 'fieldset',
