function hook_node_load


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 node.api.php hook_node_load($nodes, $types)
cle7 node.api.php hook_node_load($nodes, $types)
elmsmedia7 node.api.php hook_node_load($nodes, $types)
icor7 node.api.php hook_node_load($nodes, $types)
meedjum_blog7 node.api.php hook_node_load($nodes, $types)
mooc7 node.api.php hook_node_load($nodes, $types)

Act on arbitrary nodes being loaded from the database.

This hook should be used to add information that is not in the node or node revisions table, not to replace information that is in these tables (which could interfere with the entity cache). For performance reasons, information for all available nodes should be loaded in a single query where possible.

This hook is invoked during node loading, which is handled by entity_load(), via classes NodeController and DrupalDefaultEntityController. After the node information is read from the database or the entity cache, hook_load() is invoked on the node's content type module, then field_attach_load_revision() or field_attach_load() is called, then hook_entity_load() is invoked on all implementing modules, and finally hook_node_load() is invoked on all implementing modules.


$nodes: An array of the nodes being loaded, keyed by nid.

$types: An array containing the node types present in $nodes. Allows for an early return for modules that only support certain node types. However, if your module defines a content type, you can use hook_load() to respond to loading of just that content type.

For a detailed usage example, see nodeapi_example.module.

Related topics

12 functions implement hook_node_load()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

book_entitycache_node_load in sites/all/modules/ulmus/entitycache/entitycache.module
Implements hook_entitycache_node_load().
book_node_load in modules/book/book.module
Implements hook_node_load().
book_title_override_node_load in sites/all/modules/elmsln_contrib/book_title_override/book_title_override.module
Implements hook_node_load().
comment_node_load in modules/comment/comment.module
Implements hook_node_load().
entity_crud_hook_test_node_load in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_node_load().

... See full list

2 invocations of hook_node_load()
field_attach_load in modules/field/
Loads fields for the current revisions of a group of entities.
node_preview in modules/node/
Generates a node preview.


modules/node/node.api.php, line 554
Hooks provided by the Node module.


function hook_node_load($nodes, $types) {
  // Decide whether any of $types are relevant to our purposes.
  if (count(array_intersect($types_we_want_to_process, $types))) {
    // Gather our extra data for each of these nodes.
    $result = db_query('SELECT nid, foo FROM {mytable} WHERE nid IN(:nids)', array(':nids' => array_keys($nodes)));
    // Add our extra data to the node objects.
    foreach ($result as $record) {
      $nodes[$record->nid]->foo = $record->foo;



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.