Index: modules/fieldgroup/fieldgroup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/modules/fieldgroup/fieldgroup.module,v
retrieving revision 1.79.2.45
diff -u -r1.79.2.45 fieldgroup.module
--- modules/fieldgroup/fieldgroup.module	28 Feb 2009 23:56:17 -0000	1.79.2.45
+++ modules/fieldgroup/fieldgroup.module	29 Apr 2009 14:49:51 -0000
@@ -17,9 +17,6 @@
  */
 function fieldgroup_init() {
   drupal_add_css(drupal_get_path('module', 'fieldgroup') .'/fieldgroup.css');
-  if (module_exists('panels')) {
-    module_load_include('inc', 'fieldgroup', 'fieldgroup.panels');
-  }
 }
 
 /**
@@ -69,7 +66,7 @@
     'fieldgroup_display_overview_form' => array(
       'arguments' => array('form' => NULL),
     ),
-    'fieldgroup_panel' => array(
+    'fieldgroup_content_type' => array(
       'arguments' => array('vars' => NULL, 'nid' => NULL),
     ),
   );
@@ -789,4 +786,13 @@
     // '#chilren' might not be set if the group is empty.
     $vars[$group_name .'_rendered'] = isset($node->content[$group_name]['#children']) ? $node->content[$group_name]['#children'] : '';
   }
-}
\ No newline at end of file
+}
+
+/**
+ * Implementation of hook_ctools_plugin_directory().
+ */
+function fieldgroup_ctools_plugin_directory($module, $plugin) {
+  if ($module == 'ctools') {
+    return 'plugins/' . $plugin;
+  }
+}
Index: modules/fieldgroup/fieldgroup.panels.inc
===================================================================
RCS file: modules/fieldgroup/fieldgroup.panels.inc
diff -N modules/fieldgroup/fieldgroup.panels.inc
--- modules/fieldgroup/fieldgroup.panels.inc	10 Jan 2009 22:47:06 -0000	1.1.2.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,136 +0,0 @@
-<?php
-// $Id: fieldgroup.panels.inc,v 1.1.2.5 2009/01/10 22:47:06 yched Exp $
-
-/**
- * Implementation of hook_panels_content_types()
- */
-function fieldgroup_panels_content_types() {
-  $items = array();
-  $items['content_fieldgroup'] = array(
-    'title' => t('Content fieldgroup'),
-    'content_types' => 'fieldgroup_panels_fieldgroup_content_types',
-    'single' => TRUE, // only provides a single content type
-    'render callback' => 'fieldgroup_panels_render_fieldgroup',
-    'add callback' => 'fieldgroup_panels_edit_fieldgroup',
-    'edit callback' => 'fieldgroup_panels_edit_fieldgroup',
-    'title callback' => 'fieldgroup_panels_fieldgroup_title',
-  );
-  return $items;
-}
-
-/**
- * Return all fieldgroup panel types available.
- */
-function fieldgroup_panels_fieldgroup_content_types() {
-  return array(
-    'description' => array(
-      'title' => t('Content fieldgroup'),
-      'icon' => 'icon_node.png',
-      'path' => panels_get_path('content_types/node'),
-      'description' => t('All fields from a fieldgroup on the referenced node.'),
-      'required context' => new panels_required_context(t('Node'), 'node'),
-      'category' => array(t('Node context'), -9),
-    ),
-  );
-}
-
-/**
- * 'Render' callback for the 'fieldgroup' panel.
- */
-function fieldgroup_panels_render_fieldgroup($subtype, $conf, $panel_args, $context) {
-  $node = isset($context->data) ? drupal_clone($context->data) : NULL;
-  $block = new stdClass();
-  $block->module = 'fieldgroup';
-
-  if ($node) {
-    $groups = fieldgroup_groups($node->type);
-
-    if (isset($groups[$conf['group']])) {
-      $group = $groups[$conf['group']];
-      $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->subject = $group['label'];
-      $block->content = $output ? theme('fieldgroup_panel', $output, $node->nid) : $conf['empty'];
-      $block->delta = $node->nid;
-    }
-  }
-  else {
-    // Node context is not available. Don't print anything.
-    $block->subject = $conf['group'];
-    $block->content = '';
-    $block->delta = 'unknown';
-  }
-
-  return $block;
-}
-
-/**
- * 'Edit' callback for the 'fieldgroup' panel.
- */
-function fieldgroup_panels_edit_fieldgroup($id, $parents, $conf = array()) {
-  // Apply defaults
-  if (empty($conf)) {
-    $conf = array('title' => '', 'group' => '', 'empty' => '');
-  }
-
-  // Retrieve the list of all groups on all content types
-  $group_list = array();
-  $types = fieldgroup_groups(NULL, FALSE, FALSE);
-
-  // Add each group to the list with the content type it is from in parentheses
-  foreach ($types as $type) {
-    foreach ($type as $group) {
-      $group_list[$group['group_name']] = t('@group_label (@group_type_name)', array('@group_label' => $group['label'], '@group_type_name' => $group['type_name']));
-    }
-  }
-
-  $form['type_name'] = array(
-    '#type' => 'value',
-    '#value' => $group['type_name'],
-  );
-
-  $form['group'] = array(
-    '#type' => 'select',
-    '#title' => t('Fieldgroup'),
-    '#options' => $group_list,
-    '#default_value' => $conf['group'],
-    '#prefix' => '<div class="clear-block no-float">',
-    '#suffix' => '</div>',
-  );
-
-  $form['empty'] = array(
-    '#type' => 'textarea',
-    '#title' => 'Empty text',
-    '#description' => t('Text to display if group has no data. Note that title will not display unless overridden.'),
-    '#rows' => 5,
-    '#default_value' => $conf['empty'],
-    '#prefix' => '<div class="clear-block no-float">',
-    '#suffix' => '</div>',
-  );
-
-  return $form;
-}
-
-/**
- * 'Title' callback for the 'fieldgroup' panel.
- */
-function fieldgroup_panels_fieldgroup_title($conf, $context) {
-  $types = fieldgroup_groups(NULL, FALSE, FALSE);
-  $type = $types[$conf['type_name']][$conf['group']];
-  return t('"@s" fieldgroup @name', array('@s' => $context->identifier, '@name' => $type['label']));
-}
-
-/**
- * Allows users to theme the panels group.
- */
-function theme_fieldgroup_panel($vars, $nid) {
-  return implode('', $vars);
-}
\ No newline at end of file
Index: includes/content.panels.inc
===================================================================
RCS file: includes/content.panels.inc
diff -N includes/content.panels.inc
--- includes/content.panels.inc	3 Nov 2008 14:12:41 -0000	1.1.2.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,122 +0,0 @@
-<?php
-// $Id: content.panels.inc,v 1.1.2.6 2008/11/03 14:12:41 yched Exp $
-
-/**
- * @file
- * Panels 2 interface for CCK fieldgroups and fields.
- *
- * TODO:
- *
- * - Adjust the fields and groups that are displayed for context, when that
- *   capability is added to Panels.
- *
- */
-
-/**
- * Implementation of hook_panels_content_types()
- */
-function content_panels_content_types() {
-  $items = array();
-  $items['content_field'] = array(
-    'title' => t('Content field'),
-    'single' => TRUE,
-    'content_types' => 'content_panels_field_content_types',
-    'add callback' => 'content_panels_edit_field',
-    'edit callback' => 'content_panels_edit_field',
-    'render callback' => 'content_panels_render_field',
-    'title callback' => 'content_panels_title_content',
-  );
-  return $items;
-}
-
-function content_panels_field_content_types() {
-  return array(
-    'description' => array(
-      'title' => t('Content field'),
-      'icon' => 'icon_node.png',
-      'path' => panels_get_path('content_types/node'),
-      'description' => t('A content field from the referenced node.'),
-      'required context' => new panels_required_context(t('Node'), 'node'),
-      'category' => array(t('Node context'), -9),
-    ),
-  );
-}
-
-function content_panels_edit_field($id, $parents, $conf = array()) {
-  $form = array();
-  $form['label'] = array(
-    '#type' => 'select',
-    '#title' => t('Label'),
-    '#default_value' => isset($conf['label']) ? $conf['label'] : '',
-    '#options' => array(
-      'normal' => t('Block title'),
-      'above' => t('Above'),
-      'inline' => t('Inline'),
-      'hidden' => t('Hidden'),
-    ),
-    '#description' => t('Configure how the label is going to be displayed.'),
-  );
-  $options = array('' => '');
-  $fields = content_fields();
-  $field_types = _content_field_types();
-  foreach ($fields as $field_name => $field) {
-    $type_info = $field_types[$field['type']];
-    foreach ($type_info['formatters'] as $formatter_name => $formatter) {
-      $label  = $type_info['label'] .':'. $field['widget']['label'] ;
-      $label .= $field['widget']['label'] != $field_name ? ' ('. $field_name .')' : '';
-      $options[$label][$field_name .':'. $formatter_name] = $formatter['label'];
-    }
-  }
-  ksort($options);
-  $form['field_formatter'] = array(
-    '#type' => 'select',
-    '#title' => t('Field / Formatter'),
-    '#default_value' => isset($conf['field_formatter']) ? $conf['field_formatter'] : '',
-    '#options' => $options,
-    '#description' => t('Select a field and formatter.'),
-    '#required' => TRUE,
-  );
-  return $form;
-}
-
-/**
- * 'Title' callback for the 'field' content type.
- */
-function content_panels_title_content($subtype, $conf, $context) {
-  $data = explode(':', $conf['field_formatter']);
-  $field_name = $data[0];
-  $formatter = $data[1];
-  $fields = content_fields();
-  $field = $fields[$field_name];
-  $field_types = _content_field_types();
-  return t('"@s" field @name', array('@s' => $context->identifier, '@name' => $field_types[$field['type']]['label'] .': '. $field['widget']['label'] .' ('. $field['field_name'])) .')';
-}
-
-function content_panels_render_field($subtype, $conf, $panel_args, $context) {
-  if (is_array($context)) {
-    $context = array_pop($context);
-  }
-  $node = isset($context->data) ? drupal_clone($context->data) : NULL;
-  $data = explode(':', $conf['field_formatter']);
-  $field_name = $data[0];
-  $formatter = $data[1];
-
-  $field = content_fields($field_name);
-
-  // Force panel settings into the field's display settings.
-  $field['display_settings']['label']['format'] = $conf['label'] == 'normal' ? 'hidden' : $conf['label'];
-  $field['display_settings']['full']['format'] = $formatter;
-  $node->build_mode = NODE_BUILD_NORMAL;
-  // TODO : allow panel-specific template suggestions for content-field.tpl.php ?
-
-  $output = content_view_field($field, $node);
-
-  $block->module = 'content';
-  $block->delta = $field_name;
-  if ($conf['label'] == 'normal') {
-    $block->title = $field['widget']['label'];
-  }
-  $block->content = $output;
-
-  return $block;
-}
\ No newline at end of file
Index: content.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/Attic/content.module,v
retrieving revision 1.301.2.100
diff -u -r1.301.2.100 content.module
--- content.module	18 Mar 2009 19:20:52 -0000	1.301.2.100
+++ content.module	29 Apr 2009 14:49:51 -0000
@@ -51,9 +51,6 @@
   if (module_exists('diff') && !function_exists('content_diff')) {
     module_load_include('inc', 'content', 'includes/content.diff');
   }
-  if (module_exists('panels')) {
-    module_load_include('inc', 'content', 'includes/content.panels');
-  }
 }
 
 /**
@@ -223,6 +220,15 @@
 }
 
 /**
+ * Implementation of hook_ctools_plugin_directory().
+ */
+function content_ctools_plugin_directory($module, $plugin) {
+  if ($module == 'ctools') {
+    return 'plugins/' . $plugin;
+  }
+}
+
+/**
  * Load data for a node type's fields.
  * Implementation of hook_nodeapi 'load' op.
  *
Index: modules/fieldgroup/plugins/content_fieldgroup.inc
===================================================================
RCS file: modules/fieldgroup/plugins/content_fieldgroup.inc
diff -N modules/fieldgroup/plugins/content_fieldgroup.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/fieldgroup/plugins/content_fieldgroup.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,121 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ *   This file provides a CTools content type for fieldgroups.
+ */
+
+/**
+ * Callback function to supply a list of content types.
+ */
+function fieldgroup_content_fieldgroup_ctools_content_types() {
+  return array(
+    'title' => t('Content fieldgroup'),
+    'defaults' => array('empty' => ''),
+  );
+}
+
+/**
+ * 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
+    foreach ($node_type_groups as $fieldgroup) {
+      // 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'])));
+      
+      $types[$content_type_name] = $info;
+    }
+  }
+  
+  return $types;
+}
+
+/**
+ * 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;
+        }
+      }
+
+      $block->title = $group['label'];
+      $block->content = $output ? theme('fieldgroup_content_type', $output, $node->nid) : $conf['empty'];
+    }
+  }
+
+  return $block;
+}
+
+/**
+ * Allows users to theme the fieldgroup content type.
+ */
+function theme_fieldgroup_content_type($vars, $nid) {
+  return implode('', $vars);
+}
+
+/**
+ * Returns a settings form for the custom type.
+ */
+function fieldgroup_content_fieldgroup_content_type_edit_form(&$form, &$form_state) {
+  $conf = $form_state['conf'];
+
+  $form['empty'] = array(
+    '#type' => 'textarea',
+    '#title' => 'Empty text',
+    '#description' => t('Text to display if group has no data. Note that title will not display unless overridden.'),
+    '#rows' => 5,
+    '#default_value' => $conf['empty'],
+  );
+}
+
+function fieldgroup_content_fieldgroup_content_type_edit_form_submit(&$form, &$form_state) {
+  // Copy everything from our defaults.
+  foreach (array_keys($form_state['plugin']['defaults']) as $key) {
+    $form_state['conf'][$key] = $form_state['values'][$key];
+  }
+}
+
+/**
+ * Admin title for fieldgroup content type.
+ */
+function fieldgroup_content_fieldgroup_content_type_admin_title($subtype, $conf, $context) {
+  return t('"@s" fieldgroup (@name)', array('@s' => $context->identifier, '@name' => $subtype));
+}
+
Index: plugins/content_field.inc
===================================================================
RCS file: plugins/content_field.inc
diff -N plugins/content_field.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/content_field.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,144 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ *   This file provides a CTools content type for fields.
+ */
+
+/**
+ * Callback function to supply a list of content types.
+ */
+function content_content_field_ctools_content_types() {
+  return array(
+    'title' => t('Content field'),
+    'defaults' => array('label' => '', 'formatter' => ''),
+  );
+}
+
+/**
+ * Return all field content types available.
+ *
+ */
+function content_content_field_content_type_content_types() {
+  // This will hold all the individual field content types.
+  $types = array();
+
+  // Get all fields on the site.
+  $fields = content_fields();
+
+  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) @field', array('@type' => $field['type_name'], '@field' => $field['field_name']));
+    $info['icon'] = '';
+    $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;
+  }
+  
+  return $types;
+}
+
+/**
+ * Output function for the 'field' content type.
+ */
+function content_content_field_content_type_render($subtype, $conf, $panel_args, $context) {
+  if (is_array($context)) {
+    $context = array_pop($context);
+  }
+  $node = isset($context->data) ? drupal_clone($context->data) : NULL;
+
+  // Extract the node type and field name from the subtype
+  list($node_type, $field_name) = explode(':', $subtype, 2);
+
+  // Get the formatter that was selected in the settings dialog.
+  $formatter = $conf['field_formatter'];
+  
+  // Get more information about our field.
+  $field = content_fields($field_name);
+
+  // Force panel settings into the field's display settings.
+  $field['display_settings']['label']['format'] = $conf['label'] == 'normal' ? 'hidden' : $conf['label'];
+  $field['display_settings']['full']['format'] = $formatter;
+  $node->build_mode = NODE_BUILD_NORMAL;
+  // TODO : allow panel-specific template suggestions for content-field.tpl.php ?
+
+  $output = content_view_field($field, $node);
+
+  $block->module = 'content';
+  $block->delta = $field_name;
+  if ($conf['label'] == 'normal') {
+    $block->title = $field['widget']['label'];
+  }
+  $block->content = $output;
+
+  return $block;
+}
+
+/**
+ * Returns a settings form for the custom type.
+ */
+function content_content_field_content_type_edit_form(&$form, &$form_state) {
+  $conf = $form_state['conf'];
+
+  $form['label'] = array(
+    '#type' => 'select',
+    '#title' => t('Label'),
+    '#default_value' => isset($conf['label']) ? $conf['label'] : '',
+    '#options' => array(
+      'normal' => t('Block title'),
+      'above' => t('Above'),
+      'inline' => t('Inline'),
+      'hidden' => t('Hidden'),
+    ),
+    '#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);
+
+  // Get all the information avbout our field.
+  $field = content_fields($field_name);
+  
+  // Get information about all the field types on the site.
+  $field_types = _content_field_types();
+ 
+  // Get the information about the type that our field is.
+  $type_info = $field_types[$field['type']];
+ 
+  // Put the possible formatters for our type into an array.
+  $options = array();
+  foreach ($type_info['formatters'] as $formatter_name => $formatter) {
+    $options[$formatter_name] = $formatter['label'];
+  }
+
+  $form['formatter'] = array(
+    '#type' => 'select',
+    '#title' => t('Formatter'),
+    '#default_value' => isset($conf['formatter']) ? $conf['formatter'] : 'default',
+    '#options' => $options,
+    '#description' => t('Select a formatter.'),
+    '#required' => TRUE,
+  );
+}
+
+function content_content_field_content_type_edit_form_submit(&$form, &$form_state) {
+  // Copy everything from our defaults.
+  foreach (array_keys($form_state['plugin']['defaults']) as $key) {
+    $form_state['conf'][$key] = $form_state['values'][$key];
+  }
+}
+
+/**
+ * Admin title for field content type.
+ */
+function content_content_field_content_type_admin_title($subtype, $conf, $context) {
+  return t('"@s" field (@name)', array('@s' => $context->identifier, '@name' => $subtype));
+}
+
