? 705806-term-display-1.patch
? 705806-term-display.patch
Index: term_display.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/term_display/term_display.module,v
retrieving revision 1.16
diff -u -p -r1.16 term_display.module
--- term_display.module	21 Nov 2009 14:35:18 -0000	1.16
+++ term_display.module	5 Feb 2010 17:54:10 -0000
@@ -86,12 +86,14 @@ function term_display_form_taxonomy_form
     '#description' => t('Select if and how you wish terms to appear on content (node) display.'),
   );
 
-  $form['term_display']['term_display_weight'] = array(
-    '#type' => 'weight',
-    '#title' => t('Display weight'),
-    '#default_value' => $term_display_data['weight'],
-    '#description' => t('Set a weight for term display to control where terms appear in the content body. Set a low weight to move terms to the top of the content or a high one to move them to the bottom. Applies only when display style is set to "list" or "custom". This option is for advanced usage only; usually it\'s best to leave this at 0.'),
-  );
+  if (!module_exists('content')) {
+    $form['term_display']['term_display_weight'] = array(
+      '#type' => 'weight',
+      '#title' => t('Display weight'),
+      '#default_value' => $term_display_data['weight'],
+      '#description' => t('Set a weight for term display to control where terms appear in the content body. Set a low weight to move terms to the top of the content or a high one to move them to the bottom. Applies only when display style is set to "list" or "custom". This option is for advanced usage only; usually it\'s best to leave this at 0.'),
+    );
+  }
 }
 
 /**
@@ -188,8 +190,20 @@ function term_display_nodeapi(&$node, $o
           }
           if (!empty($terms)) {
             if ($term_display_data['style'] != TERM_DISPLAY_LOAD) {
+              if (module_exists('content')) {
+                // Due to a bug in CCK (http://drupal.org/node/363456), we need 
+                // to call this function twice to ensure we get the real value.
+                // The bug is present when you first enable the setting to
+                // display in the node instead of a separate tab, or when you
+                // first upgrade to the version that contains this code.
+                content_extra_field_weight($node->type, 'term_display');
+                $weight = content_extra_field_weight($node->type, 'term_display');
+              }
+              else {
+                $weight = $term_display_data['weight'];
+              }
               $node->content['term_display_'. $vocabulary->vid] = array(
-                '#weight' => $term_display_data['weight'],
+                '#weight' => $weight,
                 '#value' => theme('term_display_'. $term_display_data['style'], $vocabulary, $terms),
               );
             }
@@ -216,3 +230,16 @@ function term_display_ctools_plugin_dire
     return 'plugins/content_types';
   }
 }
+
+/**
+ * Implementation of hook_content_extra_fields().
+ */
+function term_display_content_extra_fields() {
+  $extras['term_display'] = array(
+    'label' => t('Term display'),
+    'description' => t('Taxonomy terms.'),
+    'weight' => 0,
+  );
+
+  return $extras;
+}
