function hook_view

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 node.api.php hook_view($node, $view_mode)
cle7 node.api.php hook_view($node, $view_mode)
elmsmedia7 node.api.php hook_view($node, $view_mode)
icor7 node.api.php hook_view($node, $view_mode)
meedjum_blog7 node.api.php hook_view($node, $view_mode)
mooc7 node.api.php hook_view($node, $view_mode)

Display a node.

This hook is invoked only on the module that defines the node's content type (use hook_node_view() to act on all node views).

This hook is invoked during node viewing after the node is fully loaded, so that the node type module can define a custom method for display, or add to the default display.

Parameters

$node: The node to be displayed, as returned by node_load().

$view_mode: View mode, e.g. 'full', 'teaser', ...

Return value

The passed $node parameter should be modified as necessary and returned so it can be properly presented. Nodes are prepared for display by assembling a structured array, formatted as in the Form API, in $node->content. As with Form API arrays, the #weight property can be used to control the relative positions of added elements. After this hook is invoked, node_view() calls field_attach_view() to add field views to $node->content, and then invokes hook_node_view() and hook_node_view_alter(), so if you want to affect the final view of the node, you might consider implementing one of these hooks instead.

Related topics

168 functions implement hook_view()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

accessibility_test_page_view in sites/all/modules/ulmus/accessibility/accessibility.module
View callback for accessibility test entities.
advanced_help_search_view in sites/all/modules/ulmus/advanced_help/advanced_help.module
Page callback for advanced help search.
aggregator_block_view in modules/aggregator/aggregator.module
Implements hook_block_view().
aggregator_view in modules/aggregator/aggregator.admin.inc
Displays the aggregator administration page.
bakery_user_view in sites/all/modules/ulmus/bakery/bakery.module
Implements hook_user_view().

... See full list

4 invocations of hook_view()
ctools_node_content_render_node in sites/all/modules/ulmus/ctools/plugins/content_types/node_context/node_content.inc
field_attach_view in modules/field/field.attach.inc
Returns a renderable array for the fields on an entity.
field_view_field in modules/field/field.module
Returns a renderable array for the value of a single field in an entity.
node_build_content in modules/node/node.module
Builds a structured array representing the node's content.

File

modules/node/node.api.php, line 1279
Hooks provided by the Node module.

Code

function hook_view($node, $view_mode) {
  if ($view_mode == 'full' && node_is_page($node)) {
    $breadcrumb = array();
    $breadcrumb[] = l(t('Home'), NULL);
    $breadcrumb[] = l(t('Example'), 'example');
    $breadcrumb[] = l($node->field1, 'example/' . $node->field1);
    drupal_set_breadcrumb($breadcrumb);
  }

  $node->content['myfield'] = array(
    '#markup' => theme('mymodule_myfield', $node->myfield),
    '#weight' => 1,
  );

  return $node;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.