--- /Users/joebaker/Projects/Drupal Development/Drupal Modules/Drupal 6/content_taxonomy/content_taxonomy.module	2008-07-11 09:11:02.000000000 +0100
+++ /Users/joebaker/Sites/oxfam/versions/oxfam_humdb/sites/all/modules/content_taxonomy/content_taxonomy.module	2008-07-17 16:18:50.000000000 +0100
@@ -5,15 +5,15 @@
 /**
  * @file
  * Defines a field type for referencing a taxonomy term.
- **/
+ */
 
 /**
  * Implementation of hook_help().
- **/
-function content_taxonomy_help($section) {
-  switch ($section) {
+ */
+function content_taxonomy_help($path, $arg) {
+  switch ($path) {
     case 'admin/modules#description':
-      return t('Defines a field type for referencing a taxonomy term. <em>Note: Requires content.module.</em>');
+      return '<p>'. t('Defines a field type for referencing a taxonomy term. <em>Note: Requires content.module.</em>') .'</p>';
   }
 }
 
@@ -54,20 +54,20 @@ function content_taxonomy_field_settings
   switch ($op) {
     case 'form':
       $form = array();
-            
+
       $form['save_term_node'] = array(
-        '#type' => 'checkbox', 
+        '#type' => 'checkbox',
         '#title' => t('Save values additionally to the core taxonomy system (into the \'term_node\' table).'),
         '#default_value' => is_numeric($field['save_term_node']) ? $field['save_term_node'] : 0,
-        '#description' => t('If this option is set, saving of terms is additionally handled by the taxonomy module. So saved terms from Content Taxonomy fields will appear as any other terms saved by the core taxonomy module. Set this option if you are using any other taxonomy application, like tagadelic. Otherwise terms are only saved in the cck tables and can only be accessed via the node or a view'), 
+        '#description' => t('If this option is set, saving of terms is additionally handled by the taxonomy module. So saved terms from Content Taxonomy fields will appear as any other terms saved by the core taxonomy module. Set this option if you are using any other taxonomy application, like tagadelic. Otherwise terms are only saved in the cck tables and can only be accessed via the node or a view'),
       );
-      
+
       $form['vocabulary'] = array(
         '#type' => 'fieldset',
         '#title' => t('Specify terms to show'),
         '#collapsible' => TRUE,
       );
-      
+
       $options_term = array();
       $options_voc = array();
       $options_term[0] = '---';
@@ -77,14 +77,14 @@ function content_taxonomy_field_settings
           $options_term[$voc->name][$term->tid] = str_repeat('- ', $term->depth) . $term->name;
         }
       }
-      
+
       $form['vocabulary']['vid'] = array(
         '#title' => t('Vocabulary'),
         '#type' => 'select',
         '#default_value' => is_numeric($field['vid']) ? $field['vid'] : 0,
         '#options' => $options_voc,
       );
-      
+
       $form['vocabulary']['tid'] = array(
         '#title' => t('Parent Term'),
         '#type' => 'select',
@@ -99,18 +99,18 @@ function content_taxonomy_field_settings
         '#default_value' => is_numeric($field['depth']) ? $field['depth'] : '',
         '#description' => t('Leave this field blank to show the whole hierarchy. By setting a value, the depth of the hierarchy shown can be limited'),
       );
-      
+
       $form['vocabulary']['show_depth'] = array(
-        '#type' => 'checkbox', 
+        '#type' => 'checkbox',
         '#title' => t('Indent child terms with \' - \' signs'),
         '#default_value' => is_numeric($field['show_depth']) ? $field['show_depth'] : 1,
         '#description' => t('This option is only relevant for hierarchical vocabularies. If this option is checked, the hierarchy gets visualized by indenting child terms, otherwise it\'s a flat list'),
       );
-      return $form;   
-    
+      return $form;
+
     case 'save':
       return array('save_term_node', 'vid', 'tid', 'depth', 'show_depth');
-    
+
     case 'database columns':
       return array(
         'value' => array('type' => 'int', 'not null' => FALSE, 'sortable' => FALSE),
@@ -122,16 +122,16 @@ function content_taxonomy_field_settings
  * Implementation of hook_field().
  */
 function content_taxonomy_field($op, &$node, $field, &$items, $teaser, $page) {
-  switch ($op) {      
+  switch ($op) {
     case 'presave':
       if ($field['save_term_node']) {
-        global $content_taxonomy_array_cleared;
-        if (!is_array($content_taxonomy_array_cleared) || !$content_taxonomy_array_cleared[$node->nid]) {
+        global $_content_taxonomy_array_cleared;
+        if (!is_array($_content_taxonomy_array_cleared) || !$_content_taxonomy_array_cleared[$node->nid]) {
           taxonomy_node_delete_revision($node);
           unset($node->taxonomy);
-          $content_taxonomy_array_cleared[$node->nid] = true;
+          $_content_taxonomy_array_cleared[$node->nid] = TRUE;
         }
-      
+
         foreach ($items as $key => $entry) {
           if ($entry['value']) {
             $node->taxonomy[$entry['value']] = $entry['value'];
@@ -193,16 +193,16 @@ function content_taxonomy_content_is_emp
  */
 function content_taxonomy_allowed_values($field) {
   $options = array();
-  
+
   //for opt groups call different function
   if (isset($field['widget']['group_tid']) && $field['widget']['group_tid'] != 0) {
     return content_taxonomy_allowed_values_groups($field);
   }
-  
+
   $depth = (is_numeric($field['depth'])) ? $field['depth'] : NULL;
 
   $tree = taxonomy_get_tree($field['vid'], $field['tid'], -1, $depth);
-  
+
   if (is_array($tree)) {
     foreach ($tree as $term) {
       if ($field['show_depth']) {
@@ -214,24 +214,24 @@ function content_taxonomy_allowed_values
       $options[$term->tid] = $value;
     }
   }
-  
+
   return $options;
 }
 
-/** 
+/**
  * Creating Opt Groups for content_taxonomy_options
  */
 function content_taxonomy_allowed_values_groups($field) {
   $options = array();
   $parent = $field['tid'];
   $group_parent = $field['widget']['group_tid'];
-  
+
   //if children in no group
   $default_terms = taxonomy_get_children($parent);
   foreach ($default_terms as $default_term) {
     $options[$default_term->tid] = $default_term->name;
   }
-  
+
   foreach (taxonomy_get_children($group_parent) as $group) {
     foreach (taxonomy_get_children($group->tid) as $term) {
       $options[$group->name][$term->tid] = $term->name;
@@ -242,4 +242,20 @@ function content_taxonomy_allowed_values
   return $options;
 }
 
-?>
+/**
+ * Implementation of hook_form_alter().
+ *
+ * hides the taxonomy form if there exists content taxonomy fields
+ */
+function content_taxonomy_form_alter(&$form, $form_state, $form_id) {
+  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
+    $info = _content_type_info();
+    $content_type = $info['content types'][$form['type']['#value']];
+    foreach ($content_type['fields'] as $field_name => $field) {
+      if ($field['type'] == 'content_taxonomy') {
+        unset($form['taxonomy']);
+        break;
+      }
+    }
+  }
+}
\ No newline at end of file
