function node_build_content

cis7 node.module node_build_content($node, $view_mode = 'full', $langcode = NULL)
cle7 node.module node_build_content($node, $view_mode = 'full', $langcode = NULL)
elmsmedia7 node.module node_build_content($node, $view_mode = 'full', $langcode = NULL)
icor7 node.module node_build_content($node, $view_mode = 'full', $langcode = NULL)
meedjum_blog7 node.module node_build_content($node, $view_mode = 'full', $langcode = NULL)
mooc7 node.module node_build_content($node, $view_mode = 'full', $langcode = NULL)

Builds a structured array representing the node's content.

The content built for the node (field values, comments, file attachments or other node components) will vary depending on the $view_mode parameter.

Drupal core defines the following view modes for nodes, with the following default use cases:

  • full (default): node is being displayed on its own page (node/123)
  • teaser: node is being displayed on the default home page listing, on taxonomy listing pages, or on blog listing pages.
  • rss: node displayed in an RSS feed.

If search.module is enabled:

  • search_index: node is being indexed for search.
  • search_result: node is being displayed as a search result.

If book.module is enabled:

  • print: node is being displayed in print-friendly mode.

Contributed modules might define additional view modes, or use existing view modes in additional contexts.


$node: A node object.

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

$langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

6 calls to node_build_content()
ctools_node_links_content_type_render in sites/all/modules/ulmus/ctools/plugins/content_types/node_context/
Output function for the 'node' content type. Outputs a node based on the module and delta supplied in the configuration.
diff_inline_show in sites/all/modules/ulmus/diff/
Show the inline diff for a given node, vid.
hook_search_execute in modules/search/search.api.php
Execute a search for a set of key words.
hook_update_index in modules/search/search.api.php
Update the search index for this module.
node_view in modules/node/node.module
Generates an array for rendering the given node.

... See full list


modules/node/node.module, line 1391
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.


function node_build_content($node, $view_mode = 'full', $langcode = NULL) {
  if (!isset($langcode)) {
    $langcode = $GLOBALS['language_content']->language;

  // Remove previously built content, if exists.
  $node->content = array();

  // Allow modules to change the view mode.
  $context = array(
    'entity_type' => 'node',
    'entity' => $node,
    'langcode' => $langcode,
  drupal_alter('entity_view_mode', $view_mode, $context);

  // The 'view' hook can be implemented to overwrite the default function
  // to display nodes.
  if (node_hook($node, 'view')) {
    $node = node_invoke($node, 'view', $view_mode, $langcode);

  // Build fields content.
  // In case of a multiple view, node_view_multiple() already ran the
  // 'prepare_view' step. An internal flag prevents the operation from running
  // twice.
  field_attach_prepare_view('node', array($node->nid => $node), $view_mode, $langcode);
  entity_prepare_view('node', array($node->nid => $node), $langcode);
  $node->content += field_attach_view('node', $node, $view_mode, $langcode);

  // Always display a read more link on teasers because we have no way to know
  // when a teaser view is different than a full view.
  $links = array();
  $node->content['links'] = array(
    '#theme' => 'links__node',
    '#pre_render' => array('drupal_pre_render_links'),
    '#attributes' => array('class' => array('links', 'inline')),
  if ($view_mode == 'teaser') {
    $node_title_stripped = strip_tags($node->title);
    $links['node-readmore'] = array(
      'title' => t('Read more<span class="element-invisible"> about @title</span>', array('@title' => $node_title_stripped)),
      'href' => 'node/' . $node->nid,
      'html' => TRUE,
      'attributes' => array(
        'rel' => 'tag',
        'title' => $node_title_stripped,
  $node->content['links']['node'] = array(
    '#theme' => 'links__node__node',
    '#links' => $links,
    '#attributes' => array('class' => array('links', 'inline')),

  // Allow modules to make their own additions to the node.
  module_invoke_all('node_view', $node, $view_mode, $langcode);
  module_invoke_all('entity_view', $node, 'node', $view_mode, $langcode);

  // Make sure the current view mode is stored if no module has already
  // populated the related key.
  $node->content += array('#view_mode' => $view_mode);



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.