node_view

modules/node/node.module, line 725

Versions
4.6 – 6
node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE)

Generate a display of the given node.

Parameters

$node A node array or node object.

$teaser Whether to display the teaser only, as on the main page.

$page Whether the node is being displayed by itself as a page.

$links Whether or not to display node links. Links are omitted for node previews.

Return value

An HTML representation of the themed node.

▾ 8 functions call node_view()

blog_page_last in modules/blog/blog.module
Displays a Drupal page containing recent blog entries of all users.
blog_page_user in modules/blog/blog.module
Displays a Drupal page containing recent blog entries of a given user.
comment_form_add_preview in modules/comment/comment.module
comment_reply in modules/comment/comment.module
This function is responsible for generating a comment reply form. There are several cases that have to be handled, including: replies to comments replies to nodes attempts to reply to nodes that can no longer accept comments respecting access...
node_page_default in modules/node/node.module
Menu callback; Generate a listing of promoted nodes.
node_show in modules/node/node.module
Generate a page displaying a single node, along with its comments.
taxonomy_render_nodes in modules/taxonomy/taxonomy.module
Accepts the result of a pager_query() call, such as that performed by taxonomy_select_nodes(), and formats each node along with a pager.
theme_node_preview in modules/node/node.module
Display a node preview for display during node creation and editing.

Code

<?php
function 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, $teaser);

    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 theme('node', $node, $teaser, $page);
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.