function node_body_field

6.x node.pages.inc node_body_field(&$node, $label, $word_count)

Return a node body field, with format and teaser.

4 calls to node_body_field()
blog_form in drupal-6.x/modules/blog/blog.module
Implementation of hook_form().
forum_form in drupal-6.x/modules/forum/forum.module
Implementation of hook_form().
hook_form in documentation-6.x/developer/hooks/node.php
Display a node editing form.
node_content_form in drupal-6.x/modules/node/node.module
Implementation of hook_form().

File

drupal-6.x/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;
}