You are here

function sheetnode_load in Sheetnode 7.2

Same name and namespace in other branches
  1. 6 sheetnode.module \sheetnode_load()
  2. 7 sheetnode.module \sheetnode_load()

Implements hook_load().

File

./sheetnode.module, line 84
Module file for the sheetnode module.

Code

function sheetnode_load($nodes) {
  $vids = array();
  foreach ($nodes as $node) {
    $vids[] = $node->vid;
    $nodes[$node->nid]->sheetnode = array(
      'nid' => $node->nid,
      'vid' => $node->vid,
      'value' => NULL,
    );
  }
  if (empty($vids)) {
    return;
  }
  $sheetnodes = db_query("SELECT * FROM {sheetnode} WHERE vid IN (:vids)", array(
    ':vids' => $vids,
  ));
  foreach ($sheetnodes as $sheetnode) {
    $nodes[$sheetnode->nid]->sheetnode = (array) $sheetnode;
  }
}