7 node.module node_load($nid = NULL, $vid = NULL, $reset = FALSE)
4.6 node.module node_load($conditions, $revision = NULL, $reset = NULL)
4.7 node.module node_load($param = array(), $revision = NULL, $reset = NULL)
5 node.module node_load($param = array(), $revision = NULL, $reset = NULL)
6 node.module node_load($param = array(), $revision = NULL, $reset = NULL)
8 node.module 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 440
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);
}

Comments

you can also use for same function
\Drupal::entityManager()->getStorage('node')->load($node_id)