Browse Source

Bug Fix: Ensure that empty chado property fields are not rendered.

Lacey Sanderson 6 years ago
parent
commit
f15758d1d8

+ 7 - 1
tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop.inc

@@ -124,6 +124,12 @@ class chado_linker__prop extends ChadoField {
         );
       }
     }
+
+    // Ensure there are no values if there are no properties.
+    // This is necessary to make sure the field is not rendered when there are no properies.
+    if (empty($properties)) {
+      unset($entity->{$field_name});
+    }
   }
 
   /**
@@ -168,4 +174,4 @@ class chado_linker__prop extends ChadoField {
     $this->queryJoinOnce($query, $prop_linker, $alias, "base.$bpkey = $alias.$bpkey AND $alias.type_id = $cvterm->cvterm_id", "LEFT OUTER");
     $query->orderBy("$alias.value", $order['direction']);
   }
-}
+}