You are here

function content_panels_render_field in Content Construction Kit (CCK) 5

1 string reference to 'content_panels_render_field'
content_panels_content_types in ./content_panels.inc
Implementation of hook_panels_content_types()

File

./content_panels.inc, line 92

Code

function content_panels_render_field($conf, $panel_args, $context) {
  if (!empty($context) && empty($context->data)) {
    return;
  }
  $node = isset($context->data) ? drupal_clone($context->data) : NULL;
  $info = _content_type_info($id);
  $data = explode(':', $conf['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']['full']['format'] = $formatter;
  $block->module = 'content';
  $block->delta = $conf['field_name'];
  if ($conf['label'] == 'normal') {
    $block->title = t($field['widget']['label']);
  }
  $node_field = isset($node->{$field}['field_name']) ? $node->{$field}['field_name'] : array();
  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);
    }
    $value = theme('field', $node, $field, $node_field, 0, 0);
  }
  $block->content = $value;
  return $block;
}