Jelajahi Sumber

Annotation Field: Ensure not rendered if no annotations are attached.

Lacey Sanderson 6 tahun lalu
induk
melakukan
d6499b48b9

+ 6 - 0
tripal_chado/includes/TripalFields/sio__annotation/sio__annotation.inc

@@ -328,6 +328,12 @@ class sio__annotation extends ChadoField {
         $entity->{$field_name}['und'][$i]['chado-' . $field_table . '__pub_id'] = $linker->pub_id;
       }
     }
+
+    // If there are no cvterms selected above then remove the stub.
+    // This is needed to ensure this field isn't displayed when there are no annotations.
+    if (sizeof($fcvterms) == 0) {
+      unset($entity->{$field_name});
+    }
   }
 }