### Eclipse Workspace Patch 1.0
#P CCK 6.x
Index: modules/fieldgroup/fieldgroup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/modules/fieldgroup/fieldgroup.module,v
retrieving revision 1.79.2.22
diff -u -r1.79.2.22 fieldgroup.module
--- modules/fieldgroup/fieldgroup.module	12 Sep 2008 14:33:13 -0000	1.79.2.22
+++ modules/fieldgroup/fieldgroup.module	13 Sep 2008 00:44:48 -0000
@@ -504,12 +504,17 @@
           }
         }
 
-        // The wrapper lets us get the themed output for the whole group
-        // once the $node->content has been rendered.
-        // See fieldgroup_preprocess_node().
+        // The wrapper lets us get the themed output for the group
+        // to populate the $GROUP_NAME_rendered variable for node templates,
+        // and hide it from the $content variable if needed.
+        // See fieldgroup_preprocess_node(), theme_fieldgroup_wrapper().
         $wrapper = array(
           'group' => $element,
           '#weight' => $group['weight'],
+          '#post_render' => array('fieldgroup_wrapper_post_render'),
+          '#group_name' => $group_name,
+          '#type_name' => $node->type,
+          '#context' => $context,
         );
 
         $node->content[$group_name] = $wrapper;
@@ -518,6 +523,17 @@
   }
 }
 
+/**
+ * Hide specified fields from the $content variable in node templates.
+ */
+function fieldgroup_wrapper_post_render($content, $element) {
+  $excluded = theme('content_excluded_fields', $element['#type_name'], $element['#context']);
+  if (in_array($element['#group_name'], (array) $excluded)) {
+    $content = '';
+  }
+  return $content;
+}
+
 /*
  * Get the group name for a field.
  * If the field isn't in a group, FALSE will be returned.
Index: content.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/content.module,v
retrieving revision 1.301.2.52
diff -u -r1.301.2.52 content.module
--- content.module	12 Sep 2008 14:33:12 -0000	1.301.2.52
+++ content.module	13 Sep 2008 00:44:47 -0000
@@ -212,6 +212,9 @@
       'path' => $path,
       'arguments' => array('form' => NULL),
     ),
+    'content_excluded_fields' => array(
+      'arguments' => array(),
+    ),
     'content_view_multiple_field' => array(
       'arguments' => array('items' => NULL, 'field' => NULL, 'data' => NULL),
     ),
@@ -737,11 +740,16 @@
         }
 
         // The wrapper lets us get the themed output for the whole field
-        // once the $node->content has been rendered.
-        // See op 'preprocess_node' below.
+        // to populate the $FIELD_NAME_rendered variable for node templates,
+        // and hide it from the $content variable if needed.
+        // See 'preprocess_node' op and theme_content_field_wrapper()?
         $wrapper = array(
           'field' => $element,
           '#weight' => $field['widget']['weight'],
+          '#post_render' => array('content_field_wrapper_post_render'),
+          '#field_name' => $field['field_name'],
+          '#type_name' => $node->type,
+          '#context' => $context,
         );
 
         $addition = array($field['field_name'] => $wrapper);
@@ -1905,6 +1913,54 @@
   return (array) $default_value;
 }
 
+ /**
+ * Hide specified fields from the $content variable in node templates.
+ */
+function content_field_wrapper_post_render($content, $element) {
+  $excluded = theme('content_excluded_fields', $element['#type_name'], $element['#context']);
+  if (in_array($element['#field_name'], (array) $excluded)) {
+    $content = '';
+  }
+  return $content;
+}
+
+/**
+ * 'Theme' function.
+ *
+ * Lists fields and fieldgroups that should be excluded from
+ * the all-inclusive $content variable in node templates.
+ * The html for those are available in the $FIELD_NAME_rendered and
+ * $GROUP_NAME_rendered variables.
+ * This allows more flexibility in node templates : you can use custom markup
+ * around a few specific fields, and print the rest of the node with $content.
+ *
+ * @param $type_name
+ *    The content-type of the node that is being rendered.
+ *
+ * @param $context
+ *    The context for which the node is being rendered.
+ *    Can be one of the following values :
+ *    - 'teaser'
+ *    - 'full'
+ *    - NODE_BUILD_SEARCH_INDEX
+ *    - NODE_BUILD_SEARCH_RESULT
+ *    - NODE_BUILD_RSS
+ *    - NODE_BUILD_PRINT
+ *
+ * @return
+ *   A PHP array, listing the fields and groups that should be excluded from $content.
+ *   Example :
+ *   switch ($type_name) :
+ *     case 'story':
+ *       return array('field_foo', 'group_bar');
+ *     case 'page':
+ *       return array('field_baz');
+ *   );
+ */
+function theme_content_excluded_fields($type_name, $context) {
+  return array();
+}
+
 /**
  * Theme preprocess function for field.tpl.php.
  *
