You are here

function contemplate_node_view in Content Templates (Contemplate) 6

Same name and namespace in other branches
  1. 5 contemplate.module \contemplate_node_view()
  2. 7 contemplate.module \contemplate_node_view()

Run example node through view hooks to present the node object parts

This is an exact copy of node_view() changed just to return the node object rather than the themed node view

  • used only on the template editing pages
1 call to contemplate_node_view()
contemplate_node_views in ./contemplate.module
Load an example node and display its parts

File

./contemplate.module, line 789
Create templates to customize teaser and body content.

Code

function contemplate_node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
  $node = (object) $node;
  $node = node_build_content($node, $teaser, $page);
  if ($links) {
    $node->links = module_invoke_all('link', 'node', $node, !$page);
    drupal_alter('link', $node->links, $node);
  }

  // Set the proper node part, then unset unused $node part so that a bad
  // theme can not open a security hole.
  $content = drupal_render($node->content);
  if ($teaser) {
    $node->teaser = $content;
    unset($node->body);
  }
  else {
    $node->body = $content;
    unset($node->teaser);
  }

  // Allow modules to modify the fully-built node.
  node_invoke_nodeapi($node, 'alter', $teaser, $page);
  return $node;
}