function node_load

Same name in other branches
  1. 7.x modules/node/node.module \node_load()

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.0.0 and is removed from drupal:9.0.0. Use \Drupal\node\Entity\Node::load().

See also

https://www.drupal.org/node/2266845

1 call to node_load()
NodeLegacyTest::testEntityLegacyCode in core/modules/node/tests/src/Kernel/NodeLegacyTest.php
@expectedDeprecation node_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\node\Entity\Node::loadMultiple(). See https://www.drupal.org/node/2266845 @expectedDeprecation node_load() is deprecated in…

File

core/modules/node/node.module, line 484

Code

function node_load($nid = NULL, $reset = FALSE) {
    @trigger_error('node_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\node\\Entity\\Node::load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
    if ($reset) {
        \Drupal::entityTypeManager()->getStorage('node')
            ->resetCache([
            $nid,
        ]);
    }
    return Node::load($nid);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.