You are here

function contemplate_node_view in Content Templates (Contemplate) 5

Same name and namespace in other branches
  1. 6 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 714
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);
    foreach (module_implements('link_alter') as $module) {
      $function = $module . '_link_alter';
      $function($node, $node->links);
    }
  }

  // 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;
}