? cck/content_panels_render_field.323681.patch
Index: cck/includes/content.panels.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/includes/Attic/content.panels.inc,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 content.panels.inc
--- cck/includes/content.panels.inc	28 Oct 2008 01:06:10 -0000	1.1.2.5
+++ cck/includes/content.panels.inc	30 Oct 2008 14:48:33 -0000
@@ -93,32 +93,51 @@ function content_panels_title_content($c
 }
 
 function content_panels_render_field($conf, $panel_args, $context) {
-  if (!empty($context) && empty($context->data)) {
-    return;
+  if (is_array($context)) {
+    $context = array_pop($context);
   }
-  $node = isset($context->data) ? drupal_clone($context->data) : NULL;
-  $info = _content_type_info($id);
-  $data = explode(':', $conf['field_formatter']);
+  $node = isset($context) ? drupal_clone($context) : NULL;
+  $info = _content_type_info();
+  $data = explode(':', $panel_args['field_formatter']);
   $field_name = $data[0];
   $formatter = $data[1];
 
   $field = $info['fields'][$field_name];
   $field_info = $info['field types'][$field['type']];
 
-  $field['display_settings']['label']['format'] = $conf['label'] == 'normal' ? 'hidden' : $conf['label'];
+  $field['display_settings']['label']['format'] = $panel_args['label'] == 'normal' ? 'hidden' : $panel_args['label'];
   $field['display_settings']['full']['format'] = $formatter;
 
   $block->module = 'content';
-  $block->delta = $conf['field_name'];
+  $block->delta = $field_name;
 
-  if ($conf['label'] == 'normal') {
-    $block->title = t($field['widget']['label']);
+  if ($panel_args['label'] == 'normal') {
+    $block->title = $field['widget']['label'];
   }
   $node_field = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();
-  foreach ($node_field as $delta => $item) {
-    $node_field[$delta]['view'] = content_format($field, $item, $formatter, $node);
+  if (content_handle('field', 'view', $field) == CONTENT_CALLBACK_CUSTOM) {
+    $field_types = _content_field_types();
+    $module = $field_types[$field['type']]['module'];
+    $function = $module .'_field';
+    if (function_exists($function)) {
+      $value = $function('view', $node, $field, $node_field, 0, 0);
+    }
+  }
+  else {
+    foreach ($node_field as $delta => $item) {
+      $node_field[$delta]['view'] = content_format($field, $item, $formatter, $node);
+    }
+//     $element = array(
+//       '#node' => $node,
+//       '#field_name' => $field_name,
+//       '#single' => sizeof($node_field) == 1,
+//       '#teaser' => NULL,
+//       '#page' => NULL,
+//       '#context' => NULL,
+//     );
+//     $value = theme('content_field', $element);
+    $value = $node_field[$delta]['view'];
   }
-  $value = theme('field', $node, $field, $node_field, 0, 0);
   $block->content = $value;
 
   return $block;
