You are here

function location_node_node_load in Location 7.3

Same name and namespace in other branches
  1. 7.4 location_node.module \location_node_node_load()

Implements hook_node_load().

@todo Make this load all locations at once instead of running separate queries for each node to enhance performance. location_load_locations() and location_load_location() will need changing to make this happen.

File

./location_node.module, line 60
Associate locations with nodes.

Code

function location_node_node_load($nodes, $types) {
  foreach ($nodes as $nid => $node) {
    $nodes[$nid]->locations = location_load_locations($node->vid);
    $nodes[$nid]->location = count($nodes[$nid]->locations) ? $nodes[$nid]->locations[0] : array();
  }
}