I have a content type I have created. It also has fields created using cck. To avoid confusion, I wish to display the body field label on the view page for the content type. I can not find a way to do this. I have searched the Drupal archives, and found only the workaround: delete the core body field and create a body field using cck.

This does not work for me because I have two years worth of data in the current core body field. Does anyone know how to make Drupal display the core body field label when viewing a node?

Comments

somebodysysop’s picture

I have also found suggestions to use hook_view or hook_nodeapi('view'), but can not locate anything which would suggest how to display the body field label using either of these.

somebodysysop’s picture

I'm getting close, but there are no guidelines on how to actually format $node->content to display label:

function hook_nodeapi(&$node, $op, $teaser) {
switch ($op) {

case 'view' :
// ******************************************************
// *** VIEW
// Display the body field label ('Summary') on node display of arbitration content type.
// ******************************************************

if ($node->type == 'arbitration') {
// All of the below generate errors
// $node->content['body'][#title] = 'Summary';
// $node->content['body'][#label_display] = 'inline';
// $node->body[#label_display] = 'inline';
}

break;
}
}

somebodysysop’s picture

	  if ($node->type == 'arbitration') {
	      $title = $node->content['#content_extra_fields']['body_field']['label'];
//          drupal_set_message('<pre>'. print_r($title, TRUE) .'</pre>');
          $body = "<strong>" . $title . ":</strong></br>" . $node->content['body']['#value'];
          $node->content['body']['#value'] = $body;
	  }
nevets’s picture

The Display Suite modules among other things adds the ability to show a label for the body.

somebodysysop’s picture

This looks like what I will have to do if I can't figure out a simpler way by using hook_something.

fabrizioprocopio’s picture

Thanks a lot
the module you pointed out
http://drupal.org/project/ds
resolved a problem of mine
thanks

fab