node_add_body_field

function node_add_body_field

node_add_body_field($type, $label = 'Body')

Adds default body field to a node type.

Parameters

$type: A node type object.

$label: The label for the body instance.

Return value

Body field instance.

File

modules/node/node.module, line 587
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_add_body_field($type, $label = 'Body') {
  // Add or remove the body field, as needed.
  $field = field_info_field('body');
  $instance = field_info_instance('node', 'body', $type->type);
  if (empty($field)) {
    $field = array(
      'field_name' => 'body',
      't