You are here

function node_body_field in Drupal 6

Return a node body field, with format and teaser.

3 calls to node_body_field()
blog_form in modules/blog/blog.module
Implementation of hook_form().
forum_form in modules/forum/forum.module
Implementation of hook_form().
node_content_form in modules/node/node.module
Implementation of hook_form().

File

modules/node/node.pages.inc, line 265
Page callbacks for adding, editing, deleting, and revisions management for content.

Code

function node_body_field(&$node, $label, $word_count) {

  // Check if we need to restore the teaser at the beginning of the body.
  $include = !isset($node->teaser) || $node->teaser == substr($node->body, 0, strlen($node->teaser));
  $form = array(
    '#after_build' => array(
      'node_teaser_js',
      'node_teaser_include_verify',
    ),
  );
  $form['#prefix'] = '<div class="body-field-wrapper">';
  $form['#suffix'] = '</div>';
  $form['teaser_js'] = array(
    '#type' => 'textarea',
    '#rows' => 10,
    '#teaser' => 'edit-body',
    '#teaser_checkbox' => 'edit-teaser-include',
    '#disabled' => TRUE,
  );
  $form['teaser_include'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show summary in full view'),
    '#default_value' => $include,
    '#prefix' => '<div class="teaser-checkbox">',
    '#suffix' => '</div>',
  );
  $form['body'] = array(
    '#type' => 'textarea',
    '#title' => check_plain($label),
    '#default_value' => $include ? $node->body : $node->teaser . $node->body,
    '#rows' => 20,
    '#required' => $word_count > 0,
  );
  $form['format'] = filter_form($node->format);
  return $form;
}