From 076a9f322189b7b570c20fe6b1d2bc4cda7e2d44 Mon Sep 17 00:00:00 2001
From: Pieter Frenssen <pieter@frenssen.be>
Date: Thu, 6 Dec 2012 16:36:20 +0100
Subject: [PATCH] Issue #1860196 by pfrenssen: Fixed Space not found when
 multiple fields reference the space taxonomy vocabulary.

---
 spaces_taxonomy/spaces_taxonomy.module | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/spaces_taxonomy/spaces_taxonomy.module b/spaces_taxonomy/spaces_taxonomy.module
index 2ad607b..ca022db 100644
--- a/spaces_taxonomy/spaces_taxonomy.module
+++ b/spaces_taxonomy/spaces_taxonomy.module
@@ -99,11 +99,12 @@ function spaces_taxonomy_get_term($node) {;
     if ($field['type'] == 'taxonomy_term_reference' && $vocab == $field['settings']['allowed_values'][0]['vocabulary']) {
       if (isset($node->{$name}['und'][0]['taxonomy_term'])) {
         $term = $node->{$name}['und'][0]['taxonomy_term'];
+        break;
       }
       elseif (isset($node->{$name}['und'][0]['tid'])) {
         $term = taxonomy_term_load($node->{$name}['und'][0]['tid']);
+        break;
       }
-      break;
     }
   }
   return $term;
-- 
1.8.0

