Browse Source

Fixed issue with entity_view

Stephen Ficklin 8 years ago
parent
commit
19693c7171
1 changed files with 14 additions and 10 deletions
  1. 14 10
      tripal/includes/tripal.entity.inc

+ 14 - 10
tripal/includes/tripal.entity.inc

@@ -309,16 +309,20 @@ function tripal_entity_view($entity, $type, $view_mode, $langcode) {
       $field = field_info_field($child_name);
       if (array_key_exists('settings', $field) and
           array_key_exists('semantic_web', $field['settings'])) {
-        list($vocabulary, $accession) = explode(':', $field['settings']['semantic_web']);
-        $term = tripal_get_term_details($vocabulary, $accession);
-        if ($term) {
-          $tooltip_img = url(drupal_get_path('module', 'tripal') . '/theme/images/info.gif');
-          $tooltip_text = $term['definition'] ? $term['definition'] : $term['name'];
-          $entity->content[$child_name]['#prefix'] .= '' .
-            '<div class="tripal-tooltip">' .
-              '<img src="' . $tooltip_img . '">' .
-              '<div class="tripal-tooltiptext">' . $tooltip_text . '</div>' .
-            '</div>';
+        $matches = array();
+        if (preg_match('/^(.+):(.+)$/', $field['settings']['semantic_web'], $matches)) {
+          $vocabulary = $matches[1];
+          $accession = $matches[2];
+          $term = tripal_get_term_details($vocabulary, $accession);
+          if ($term) {
+            $tooltip_img = url(drupal_get_path('module', 'tripal') . '/theme/images/info.gif');
+            $tooltip_text = $term['definition'] ? $term['definition'] : $term['name'];
+            $entity->content[$child_name]['#prefix'] .= '' .
+              '<div class="tripal-tooltip">' .
+                '<img src="' . $tooltip_img . '">' .
+                '<div class="tripal-tooltiptext">' . $tooltip_text . '</div>' .
+              '</div>';
+          }
         }
       }
     }