From d9b8bed76fd78b22fb7243752230bdc0e8bdef19 Mon Sep 17 00:00:00 2001
From: Tim Plunkett <git@plnktt.com>
Date: Tue, 6 Sep 2011 09:46:17 -0400
Subject: [PATCH] Issue #1259916 by tim.plunkett: Load reference fields when building content.

---
 includes/entity.controller.inc |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/includes/entity.controller.inc b/includes/entity.controller.inc
index a60d835..afe74c5 100644
--- a/includes/entity.controller.inc
+++ b/includes/entity.controller.inc
@@ -428,6 +428,8 @@ class EntityAPIController extends DrupalDefaultEntityController implements Entit
 
     // Add in fields.
     if (!empty($this->entityInfo['fieldable'])) {
+      $key = isset($entity->{$this->idKey}) ? $entity->{$this->idKey} : NULL;
+      field_attach_prepare_view($this->entityType, array($key => $entity), $view_mode);
       $entity->content += field_attach_view($this->entityType, $entity, $view_mode, $langcode);
     }
     // Invoke hook_ENTITY_view() to allow modules to add their additions.
-- 
1.7.3.2

