hook_load

  1. drupal
    1. drupal6 node.php
    2. drupal7
Versionen
drupal6 hook_load($node)
drupal7 hook_load($nodes)

Load node-type-specific information.

This is a hook used by node modules. It is called to allow the module a chance to load extra information that it stores about a node. The hook should not be used to replace information from the core {node} table since this may interfere with the way nodes are fetched from cache.

Übergabeparameter

$nodes An array of the nodes being loaded, keyed by nid. At call time, node.module has already loaded the basic information about the nodes, such as node ID (nid), title, and body.

For a detailed usage example, see node_example.module.

Verwandte Themen

Code

modules/node/node.api.php, line 810

<?php
function hook_load($nodes) {
  $result = db_query('SELECT nid, foo FROM {mytable} WHERE nid IN (:nids)', array(':nids' => array_keys($nodes)));
  foreach ($result as $record) {
    $nodes[$record->nid]->foo = $record->foo;
  }
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen