Same name and namespace in other branches
  1. 6.x modules/node/node.module \node_content_form()
  2. 7.x modules/node/node.module \node_content_form()

Implementation of hook_form().

Related topics

File

modules/node/node.module, line 3069
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_content_form($node) {
  $type = node_get_types('type', $node);
  $form = array();
  if ($type->has_title) {
    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => check_plain($type->title_label),
      '#required' => TRUE,
      '#default_value' => $node->title,
      '#weight' => -5,
    );
  }
  if ($type->has_body) {
    $form['body_filter']['body'] = array(
      '#type' => 'textarea',
      '#title' => check_plain($type->body_label),
      '#default_value' => $node->body,
      '#rows' => 20,
      '#required' => $type->min_word_count > 0,
    );
    $form['body_filter']['format'] = filter_form($node->format);
  }
  return $form;
}