You are here

function domain_source_node_load in Domain Access 7.3

Same name and namespace in other branches
  1. 7.2 domain_source/domain_source.module \domain_source_node_load()

Implements hook_node_load().

File

domain_source/domain_source.module, line 190
Creates a source domain for linking to content from other domains.

Code

function domain_source_node_load($nodes, $types) {
  $results = db_query("SELECT nid, domain_id FROM {domain_source} WHERE nid IN (:nid)", array(
    ':nid' => array_keys($nodes),
  ))
    ->fetchAllAssoc('nid');
  foreach ($nodes as $nid => $node) {

    // Cannot load if the node has not been created yet.
    if (!isset($results[$nid])) {
      $nodes[$node->nid]->domain_source = NULL;
    }
    else {
      $nodes[$node->nid]->domain_source = $results[$node->nid]->domain_id;
    }
  }
}