Browse Source

fixing the issue with the fields array for the tripal entity load call

Shawna Spoor 7 years ago
parent
commit
4328d12352
1 changed files with 11 additions and 1 deletions
  1. 11 1
      tripal/includes/tripal.bulk_update.inc

+ 11 - 1
tripal/includes/tripal.bulk_update.inc

@@ -27,7 +27,16 @@ function tripal_update_all($bundle_id, $update, $type) {
   $i = 0;
   // Pull items out one at a time.
   while ($entity = $queue->claimItem()) {
-    $arg = tripal_load_entity('TripalEntity', [$entity->data->entity_id], FALSE, $bundle_tokens);
+    $fields = array();
+    foreach ($bundle_tokens as $bundle_token) {
+      foreach ($bundle_token as $token) {
+        $string = str_replace(array('[', ']'), '', $token);
+        $field_array = field_info_field($string);
+        $fields[] = $field_array['id'];
+      }
+    }
+    $arg = tripal_load_entity('TripalEntity', [$entity->data->entity_id], FALSE, $fields);
+
     if ($type == 'alias') {
       if (!empty($arg)) {
         if (is_array($arg)) {
@@ -43,6 +52,7 @@ function tripal_update_all($bundle_id, $update, $type) {
         if (is_array($arg)) {
           $ent = reset($arg);
         }
+
         $ec = entity_get_controller('TripalEntity');
         $ec->setTitle($ent, $update);
       }