Browse Source

Fixed error message when hook_bundle_fields_info implementation does not return an array

Stephen Ficklin 6 years ago
parent
commit
e2e494a314
1 changed files with 10 additions and 2 deletions
  1. 10 2
      tripal/api/tripal.entities.api.inc

+ 10 - 2
tripal/api/tripal.entities.api.inc

@@ -634,7 +634,11 @@ function tripal_create_bundle_fields($bundle, $term) {
   foreach ($modules as $module) {
     $function = $module . '_bundle_fields_info';
     $temp = $function('TripalEntity', $bundle);
-    $info = array_merge($info, $temp);
+    if (is_array($temp)) {
+      // TODO: it would be good to check this array to make sure it follows
+      // protocol.  It would help identify potential errors.
+      $info = array_merge($info, $temp);
+    }
   }
 
   // Allow modules to alter which fields should be attached to content
@@ -668,7 +672,11 @@ function tripal_create_bundle_fields($bundle, $term) {
   foreach ($modules as $module) {
     $function = $module . '_bundle_instances_info';
     $temp = $function('TripalEntity', $bundle);
-    $info = array_merge($info, $temp);
+    if (is_array($temp)) {
+      // TODO: it would be good to check this array to make sure it follows
+      // protocol.  It would help identify potential errors.
+      $info = array_merge($info, $temp);
+    }
   }
 
   // Allow modules to alter which fields should be attached to content