1 node.module node_build_content(Node $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.

Backdrop core defines the following display 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, or on taxonomy 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 display modes, or use existing display modes in additional contexts.

Parameters

Node $node: A node entity.

$view_mode: (optional) Display mode, e.g. 'full' or 'teaser'. Defaults to 'full'.

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

File

core/modules/node/node.module, line 1148
The core module that allows content to be submitted to the site.

Code

function node_build_content(Node $node, $view_mode = 'full', $langcode = NULL) {
  $node->buildContent($view_mode, $langcode);
}