summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/node_reference/node_reference.module7
1 files changed, 2 insertions, 5 deletions
diff --git a/modules/node_reference/node_reference.module b/modules/node_reference/node_reference.module
index c5d67bd..13534c7 100644
--- a/modules/node_reference/node_reference.module
+++ b/modules/node_reference/node_reference.module
@@ -149,15 +149,12 @@ function node_reference_field_prepare_view($entity_type, $entities, $field, $ins
if (!user_access('administer nodes')) {
$query->condition('status', 1);
}
- $results = $query->execute();
- foreach ($results as $row) {
- $fetched_nodes[$row->nid] = $row;
- }
+ $fetched_nodes = $query->execute()->fetchAllAssoc('nid');
}
foreach ($items as $id => $entity_items) {
foreach ($entity_items as $delta => $item) {
- if (is_array($item) && !empty($item['nid']) && isset($fetched_nodes[$item['nid']]) && $item['nid']) {
+ if (is_array($item) && !empty($item['nid']) && isset($fetched_nodes[$item['nid']])) {
$items[$id][$delta]['node'] = $fetched_nodes[$item['nid']];
$items[$id][$delta]['access'] = TRUE;
}