*** lexicon.module	2012-05-04 15:04:47.000000000 +0200
--- /Users/xav/Developpement/www/yogarik/sites/all/modules/custom/lexicon/lexicon.module	2012-05-06 14:37:42.000000000 +0200
***************
*** 1027,1044 ****
  
      // If there is an image for the term add the image information to the $term
      // object.
!     $image_field_items = field_get_items('taxonomy_term', $term, $image_field);
!     if (!empty($image_field_items)) {
!       $term->image['uri'] = $image_field_items[0]['uri'];
!       $term->image['alt'] = check_plain($image_field_items[0]['alt']);
!       $term->image['title'] = check_plain($image_field_items[0]['title']);
      }
! 
!     // If there are synonyms add them to the $term object.
!     $synonyms_field_items = field_get_items('taxonomy_term', $term, $synonyms_field);
!     if (!empty($synonyms_field_items)) {
!       foreach ($synonyms_field_items as $item) {
!         $term->synonyms[] = $item['safe_value'];
        }
      }
  
--- 1027,1048 ----
  
      // If there is an image for the term add the image information to the $term
      // object.
!     if (!empty($image_field)) {
!       $image_field_items = field_get_items('taxonomy_term', $term, $image_field);
!       if (!empty($image_field_items)) {
!         $term->image['uri'] = $image_field_items[0]['uri'];
!         $term->image['alt'] = check_plain($image_field_items[0]['alt']);
!         $term->image['title'] = check_plain($image_field_items[0]['title']);
!       }
      }
!     
!     if (!empty($synonyms_field)) {
!       // If there are synonyms add them to the $term object.
!       $synonyms_field_items = field_get_items('taxonomy_term', $term, $synonyms_field);
!       if (!empty($synonyms_field_items)) {
!         foreach ($synonyms_field_items as $item) {
!           $term->synonyms[] = $item['safe_value'];
!         }
        }
      }
  
***************
*** 1144,1159 ****
    $related = array();
    $related_term_field = variable_get('lexicon_related_terms_field_' . $term->vid, '');
  
!   $related_term_field_items = field_get_items('taxonomy_term', $term, $related_term_field);
!   if (!empty($related_term_field_items)) {
!     foreach ($related_term_field_items as $item) {
!       $rel_term = taxonomy_term_load($item['tid']);
!       if ($rel_term != FALSE) {
!         $related[$item['tid']] = $rel_term;
        }
      }
    }
! 
    return $related;
  }
  
--- 1148,1165 ----
    $related = array();
    $related_term_field = variable_get('lexicon_related_terms_field_' . $term->vid, '');
  
!   if (!empty($related_term_field)) {
!     $related_term_field_items = field_get_items('taxonomy_term', $term, $related_term_field);
!     if (!empty($related_term_field_items)) {
!       foreach ($related_term_field_items as $item) {
!         $rel_term = taxonomy_term_load($item['tid']);
!         if ($rel_term != FALSE) {
!           $related[$item['tid']] = $rel_term;
!         }
        }
      }
    }
!   
    return $related;
  }
  
