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);
}
doc_Drupal
2016-10-29 09:31:55
Comments
Leave a Comment

Please login to continue.