You are here

function node_teaser_js in Drupal 6

See if the user used JS to submit a teaser.

1 string reference to 'node_teaser_js'
node_body_field in modules/node/node.pages.inc
Return a node body field, with format and teaser.

File

modules/node/node.module, line 222
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_teaser_js(&$form, &$form_state) {
  if (isset($form['#post']['teaser_js'])) {

    // Glue the teaser to the body.
    if (trim($form_state['values']['teaser_js'])) {

      // Space the teaser from the body
      $body = trim($form_state['values']['teaser_js']) . "\r\n<!--break-->\r\n" . trim($form_state['values']['body']);
    }
    else {

      // Empty teaser, no spaces.
      $body = '<!--break-->' . $form_state['values']['body'];
    }

    // Pass updated body value on to preview/submit form processing.
    form_set_value($form['body'], $body, $form_state);

    // Pass updated body value back onto form for those cases
    // in which the form is redisplayed.
    $form['body']['#value'] = $body;
  }
  return $form;
}