Browse Source

Trying to rework support of TripalFields and views'

Stephen Ficklin 8 years ago
parent
commit
384e0962da

+ 5 - 4
tripal/tripal_views_query.inc

@@ -26,7 +26,7 @@ class tripal_views_query extends views_plugin_query_default {
       return parent::add_field($table_alias, $field, $alias, $params);
     }
     else {
-      $this->attach_fields[] = $f['id'];
+      $this->attach_fields[] = $f;
     }
   }
 
@@ -45,9 +45,10 @@ class tripal_views_query extends views_plugin_query_default {
       $bundle_name = $view->result[$i]->tripal_bundle_name;
       $ids = array($entity_id, 0, $bundle_name);
       $entity = entity_create_stub_entity('TripalEntity', $ids);
-      foreach ($this->attach_fields as $fid) {
-        $options = array('field_id' => $fid);
-        field_attach_load('TripalEntity', array($entity_id => $entity), FIELD_LOAD_CURRENT, $options);
+      foreach ($this->attach_fields as $field) {
+        $entities = array($entity_id => $entity);
+        module_invoke($field['storage']['module'], 'field_storage_load', 'TripalEntity',
+          $entities, FIELD_LOAD_CURRENT, array($field['id'] => array($entity_id)));
       }
       $view->result[$i]->entity = $entity;
     }

+ 2 - 1
tripal_chado/includes/tripal_chado.field_storage.inc

@@ -195,7 +195,7 @@ function tripal_chado_field_storage_load($entity_type, $entities, $age,
       $base_table = $entity->chado_table;
       $type_field = $entity->chado_column;
       $record_id  = $entity->chado_record_id;
-   }
+    }
     else {
       $bundle = tripal_load_bundle_entity(array('name' => $entity->bundle));
       $base_table = $bundle->data_table;
@@ -242,6 +242,7 @@ function tripal_chado_field_storage_load($entity_type, $entities, $age,
       // a bundle using the user UI form.
       // TODO: how to deal with deleted fields?
       $instance = field_info_instance($entity_type, $field_name, $entity->bundle);
+
       if (!$instance) {
         continue;
       }