You are here

function hosting_node_load in Hosting 7.3

Same name and namespace in other branches
  1. 7.4 hosting.module \hosting_node_load()

Implements hook_node_load().

See also

hook_nodeapi_TYPE_OP()

File

./hosting.module, line 283
Hosting module.

Code

function hosting_node_load($nodes, $types) {

  // Decide whether any of $types are relevant to our purposes.
  // Gather our extra data for each of these nodes.
  $result = db_query("SELECT nid, name AS hosting_name FROM {hosting_context} WHERE nid IN(:nids)", array(
    ':nids' => array_keys($nodes),
  ))
    ->fetchAllKeyed();

  // Add our extra data to the node objects.
  foreach ($result as $nid => $hosting_name) {
    $nodes[$nid]->hosting_name = $hosting_name;

    // Redispatch through our custom nodeapi implementation.
    hosting_nodeapi($nodes[$nid], 'load');
  }
}