W3cubDocs

/Drupal 8

function node_load

node_load($nid = NULL, $reset = FALSE)

Loads a node entity from the database.

Parameters

int $nid: The node ID.

bool $reset: (optional) Whether to reset the node_load_multiple() cache. Defaults to FALSE.

Return value

\Drupal\node\NodeInterface|null A fully-populated node entity, or NULL if the node is not found.

Deprecated

in Drupal 8.x, will be removed before Drupal 9.0. Use \Drupal\node\Entity\Node::load().

File

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

Code

function node_load($nid = NULL, $reset = FALSE) {
  if ($reset) {
    \Drupal::entityManager()->getStorage('node')->resetCache(array($nid));
  }
  return Node::load($nid);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!node!node.module/function/node_load/8.1.x