Index: includes/panels/content_types/content_field.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/includes/panels/content_types/Attic/content_field.inc,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 content_field.inc
--- includes/panels/content_types/content_field.inc	8 Jul 2009 15:25:43 -0000	1.1.2.5
+++ includes/panels/content_types/content_field.inc	8 Jul 2009 16:17:04 -0000
@@ -24,27 +24,35 @@ function content_content_field_content_t
   $types = array();
 
   // Get all fields on the site.
-  $fields = content_fields();
   $field_types = _content_field_types();
-  $node_types = node_get_types();
 
-  foreach ($fields as $field) {
-    // Name the content type a combination of field and node type names.
-    $content_type_name = $field['type_name'] . ':' . $field['field_name'];
-
-    // Assemble the information about the content type.
-    $info = array();
-    $info['title'] = t('@type: (@field_type) @field', array('@type' => $node_types[$field['type_name']]->name, '@field' => $field['field_name'], '@field_type' => $field_types[$field['type']]['label']));
-
-    if (isset($field_types[$field['type']]['content_icon'])) {
-      $info['icon'] = $field_types[$field['type']]['content_icon'];
+  foreach (content_types() as $type_name => $type) {
+    foreach ($type['fields'] as $field_name => $field) {
+      if (!isset($types[$field_name])) {
+        $types[$field_name] = array(
+          'category' => t('Content'),
+          'title' => t('@widget_label (@field_name) - @field_type', array(
+            '@widget_label' => t($field['widget']['label']),
+            '@field_name' => $field_name,
+            '@field_type' => t($field_types[$field['type']]['label']),
+          )),
+          'description' => t('Field on the referenced node.'),
+          'types' => array(),
+        );
+        if (isset($field_types[$field['type']]['content_icon'])) {
+          $types[$field_name]['icon'] = $field_types[$field['type']]['content_icon'];
+        }
+      }
+      $types[$field_name]['types'][$type_name] = $type['name'];
     }
+  }
 
-    $info['category'] = 'Content';
-    $info['description'] = t('Field on the referenced node.');
-    $info['required context'] = new ctools_context_required(t('Node'), 'node', array('type' => array($field['type_name'])));
-
-    $types[$content_type_name] = $info;
+  // Create the required context for each field related to the content types.
+  foreach ($types as $field_name => $field_content_type) {
+    $types[$field_name]['required context'] = new ctools_context_required(t('Node'), 'node', array(
+      'type' => array_keys($types[$field_name]['types']),
+    ));
+    unset($types[$field_name]['types']);
   }
 
   return $types;
@@ -57,17 +65,20 @@ function content_content_field_content_t
   if (is_array($context)) {
     $context = array_pop($context);
   }
-  $node = isset($context->data) ? drupal_clone($context->data) : NULL;
+  // If we do not have a node, then we cannot generate output.
+  if (!isset($context->data)) {
+    return;
+  }
+  $node = drupal_clone($context->data);
 
-  // Extract the node type and field name from the subtype
-  list($node_type, $field_name) = explode(':', $subtype, 2);
+  // Extract the node type from the node in context, the field name from the
+  // panels content type subtype, and get the content field structure.
+  $field_name = $subtype;
+  $field = content_fields($field_name, $node->type);
 
   // Get the formatter that was selected in the settings dialog.
   $formatter = $conf['formatter'];
 
-  // Get more information about our field.
-  $field = content_fields($field_name, $node_type);
-
   // Check view access to the field.
   if (!content_access('view', $field)) {
     return;
@@ -81,6 +92,7 @@ function content_content_field_content_t
 
   $output = content_view_field($field, $node);
 
+  $block = new stdClass();
   $block->module = 'content';
   $block->delta = $field_name;
   if ($conf['label'] == 'normal') {
@@ -110,11 +122,11 @@ function content_content_field_content_t
     '#description' => t('Configure how the label is going to be displayed.'),
   );
 
-  // Extract the node type and field name from the subtype
-  list($node_type, $field_name) = explode(':', $form_state['subtype_name'], 2);
+  // Extract the field name from the panels content type subtype.
+  $field_name = $form_state['subtype_name'];
 
   // Get all the information about our field.
-  $field = content_fields($field_name, $node_type);
+  $field = content_fields($field_name);
 
   // Get information about all the field types on the site.
   $field_types = _content_field_types();
Index: modules/fieldgroup/panels/content_types/content_fieldgroup.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/modules/fieldgroup/panels/content_types/Attic/content_fieldgroup.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 content_fieldgroup.inc
--- modules/fieldgroup/panels/content_types/content_fieldgroup.inc	29 Apr 2009 18:34:46 -0000	1.1.2.1
+++ modules/fieldgroup/panels/content_types/content_fieldgroup.inc	8 Jul 2009 16:13:18 -0000
@@ -3,7 +3,7 @@
 
 /**
  * @file
- *   This file provides a CTools content type for fieldgroups.
+ * This file provides a CTools content type for fieldgroups.
  */
 
 /**
@@ -18,34 +18,38 @@ function fieldgroup_content_fieldgroup_c
 
 /**
  * Return all fieldgroup content types available.
- *
  */
 function fieldgroup_content_fieldgroup_content_type_content_types() {
   // This will hold all the individual fieldgroup content types.
   $types = array();
 
-  // Retrieve the list of all groups on all content types
-  $node_types_groups = fieldgroup_groups(NULL, FALSE, FALSE);
-
-  // The outer loop goes through each node type with groups 
-  foreach ($node_types_groups as $node_type_groups) {
-    // The inner loop gives us each fieldgroup on each node type with groups
+  // The outer loop goes through each node type with groups.
+  foreach (fieldgroup_groups() as $node_type_groups) {
+    // The inner loop gives us each fieldgroup on each node type with groups.
     foreach ($node_type_groups as $fieldgroup) {
+      // Skip field groups that are not of standard type.
+      if ($fieldgroup['group_type'] != 'standard') {
+        continue;
+      }
+
       // Name the content type a combination of fieldgroup and node type names.
       $content_type_name = $fieldgroup['type_name'] . ':' . $fieldgroup['group_name'];
-      
-      // Assemble the information about the content type. 
-      $info = array();    
-      $info['title'] = t('@type: (fieldgroup) @fieldgroup', array('@type' => $fieldgroup['type_name'], '@fieldgroup' => $fieldgroup['label']));
-      $info['icon'] = '';
-      $info['category'] = 'Content';
-      $info['description'] = t('All fields from this fieldgroup on the referenced node.');
-      $info['required context'] = new ctools_context_required(t('Node'), 'node', array('type' => array($fieldgroup['type_name'])));
-      
+
+      // Assemble the information about the content type.
+      $info = array(
+        'category' => t('Content'),
+        'title' => t('@group in @type (standard field group)', array(
+          '@group' => t($fieldgroup['label']),
+          '@type' => node_get_types('name', $fieldgroup['type_name']),
+        )),
+        'description' => t('All fields from this field group on the referenced node.'),
+        'required context' => new ctools_context_required(t('Node'), 'node', array('type' => array($fieldgroup['type_name']))),
+      );
+
       $types[$content_type_name] = $info;
     }
   }
-  
+
   return $types;
 }
 
@@ -53,33 +57,36 @@ function fieldgroup_content_fieldgroup_c
  * Output function for the 'fieldgroup' content type.
  */
 function fieldgroup_content_fieldgroup_content_type_render($subtype, $conf, $panel_args, $context) {
-  $node = isset($context->data) ? drupal_clone($context->data) : NULL;
-  $block = new stdClass();
-  
-  if ($node) {
-    // Extract the node type and fieldgroup name from the subtype
-    list($node_type, $fieldgroup_name) = explode(':', $subtype, 2);
-  
-    // Get a list of all fieldgroups for this node type
-    $groups = fieldgroup_groups($node_type);
-
-    if (isset($groups[$fieldgroup_name])) {
-      $group = $groups[$fieldgroup_name];
-      $output = array();
-
-      foreach ($group['fields'] as $field_name => $field) {
-        $field = content_fields($field_name, $node_type);
-        $field_view = content_view_field($field, $node);
-        if (!is_null($field_view)) {
-          $output[] = $field_view;
-        }
-      }
+  if (!isset($context->data)) {
+    return;
+  }
+  $node = drupal_clone($context->data);
 
-      $block->title = $group['label'];
-      $block->content = $output ? theme('fieldgroup_content_type', $output, $node->nid) : $conf['empty'];
+  // Extract the node type and fieldgroup name from the subtype.
+  list($node_type, $fieldgroup_name) = explode(':', $subtype, 2);
+
+  // Get a list of all fieldgroups for this node type.
+  $groups = fieldgroup_groups($node_type);
+
+  if (!isset($groups[$fieldgroup_name])) {
+    return;
+  }
+
+  $group = $groups[$fieldgroup_name];
+  $output = array();
+
+  foreach ($group['fields'] as $field_name => $field) {
+    $field = content_fields($field_name, $node_type);
+    $field_view = content_view_field($field, $node);
+    if (!is_null($field_view)) {
+      $output[] = $field_view;
     }
   }
 
+  $block = new stdClass();
+  $block->title = $group['label'];
+  $block->content = !empty($output) ? theme('fieldgroup_content_type', $output, $node->nid) : $conf['empty'];
+
   return $block;
 }
 
@@ -118,4 +125,3 @@ function fieldgroup_content_fieldgroup_c
 function fieldgroup_content_fieldgroup_content_type_admin_title($subtype, $conf, $context) {
   return t('"@s" fieldgroup (@name)', array('@s' => $context->identifier, '@name' => $subtype));
 }
-
