Community Documentation

hook_view

5 node.php hook_view($node, $teaser = FALSE, $page = FALSE)
6 node.php hook_view($node, $teaser = FALSE, $page = FALSE)
7 node.api.php hook_view($node, $view_mode)
8 node.api.php hook_view($node, $view_mode)

Display a node.

This is a hook used by node modules. It allows a module to define a custom method of displaying its nodes, usually by displaying extra information particular to that node type.

Parameters

&$node: The node to be displayed.

$teaser: Whether we are to generate a "teaser" or summary of the node, rather than display the whole thing.

$page: Whether the node is being displayed as a standalone page. If this is TRUE, the node title should not be displayed, as it will be printed automatically by the theme system. Also, the module may choose to alter the default breadcrumb trail in this case.

Return value

None. The passed-by-reference $node parameter should be modified as necessary so it can be properly presented by theme('node', $node). This means, for instance, that content should be passed through the filter system by calling check_output() on appropriate fields or by sending the node through node_prepare().

For a detailed usage example, see node_example.module.

Related topics

▾ 30 functions implement hook_view()

aggregator_admin_overview in modules/aggregator.module
Menu callback; displays the aggregator administration page.
aggregator_view in modules/aggregator.module
blog_view in modules/blog.module
Implementation of hook_view().
book_admin_overview in modules/book.module
Returns an administrative overview of all books.
book_view in modules/book.module
Implementation of hook_view().
comment_admin_overview in modules/comment.module
Menu callback; present an administrative comment listing.
comment_form_add_preview in modules/comment.module
fileupload_view in developer/examples/fileupload.module
Implementation of hook_view.
filter_admin_overview in modules/filter.module
Displays a list of all input formats and which one is the default
forum_overview in modules/forum.module
Returns an overview list of existing forums and containers
forum_view in modules/forum.module
Implementation of hook_view().
menu_overview in modules/menu.module
Menu callback; present the main menu management page.
multipage_form_example_view in developer/examples/multipage_form_example.module
Implementation of hook_view().
node_example_view in developer/examples/node_example.module
Implementation of hook_view().
node_form_add_preview in modules/node.module
node_preview in modules/node.module
Generate a node preview.
node_revision_overview in modules/node.module
Generate an overview table of older revisions of a node.
node_view in modules/node.module
Generate a display of the given node.
path_overview in modules/path.module
Return a listing of all defined URL aliases.
poll_view in modules/poll.module
Implementation of hook_view().
profile_admin_overview in modules/profile.module
Menu callback; display a listing of all editable profile fields.
search_view in modules/search.module
Menu callback; presents the search form and/or search results.
theme_comment_admin_overview in modules/comment.module
theme_comment_preview in modules/comment.module
theme_comment_view in modules/comment.module
theme_filter_admin_overview in modules/filter.module
theme_node_preview in modules/node.module
Display a node preview for display during node creation and editing.
theme_watchdog_form_overview in modules/watchdog.module
user_view in modules/user.module
watchdog_overview in modules/watchdog.module
Menu callback; displays a listing of log messages.

File

developer/hooks/node.php, line 341
These hooks are defined by node modules, modules that define a new kind of node.

Code

<?php
function hook_view(&$node, $teaser = FALSE, $page = FALSE) {
  if ($page) {
    $breadcrumb = array();
    $breadcrumb[] = array(
      'path' => 'example',
      'title' => t('example'),
    );
    $breadcrumb[] = array(
      'path' => 'example/' . $node->field1, 
      'title' => t('%category', array('%category' => $node->field1)),
    );
    $breadcrumb[] = array('path' => 'node/' . $node->nid);
    menu_set_location($breadcrumb);
  }

  $node = node_prepare($node, $teaser);
}
?>
Login or register to post comments