node_prepare

5 node.module node_prepare($node, $teaser = FALSE)
6 node.module node_prepare($node, $teaser = FALSE)

Apply filters and build the node's standard elements.

11 calls to node_prepare()

File

modules/node/node.module, line 760
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_prepare($node, $teaser = FALSE) {
  // First we'll overwrite the existing node teaser and body with
  // the filtered copies! Then, we'll stick those into the content
  // array and set the read more flag if appropriate.
  $node->readmore = (strlen($node->teaser) < strlen($node->body));

  if ($teaser == FALSE) {
    $node->body = check_markup($node->body, $node->format, FALSE);
  }
  else {
    $node->teaser = check_markup($node->teaser, $node->format, FALSE);
  }

  $node->content['body'] = array(
    '#value' => $teaser ? $node->teaser : $node->body, 
    '#weight' => 0,
  );

  return $node;
}
Login or register to post comments