ソースを参照

Ensure that tripal_views integrates all chado tables described in the chado schema api -have lowest priority (10)

Lacey Sanderson 12 年 前
コミット
6936022808
2 ファイル変更20 行追加0 行削除
  1. 17 0
      tripal_views/tripal_views.api.inc
  2. 3 0
      tripal_views/tripal_views.views.inc

+ 17 - 0
tripal_views/tripal_views.api.inc

@@ -362,6 +362,22 @@ function tripal_views_integration_remove_entry_by_setup_id($setup_id) {
 
 }
 
+/**
+ * Integrate all chado tables in the schema api
+ */
+function tripal_views_integrate_all_chado_tables() {
+
+  $tables = tripal_core_get_chado_tables();
+  foreach ($tables as $tablename) {
+    if (!tripal_views_is_integrated($tablename, 10)) {
+      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, 10);
+      if ($table_integration_array) {
+        tripal_views_integration_add_entry($table_integration_array);
+      }
+    }
+  }
+}
+
 /**
  * Returns the array needed to integrate a given chado table with views
  *
@@ -390,6 +406,7 @@ function tripal_views_get_integration_array_for_chado_table($table_name, $base_t
   if (!isset($schema['fields'])) {
     $schema['fields'] = array();
     drupal_set_message(t('There are no fields defined for %table in the Chado Schema API.', array('%table' => $table_name)), 'warning');
+    return FALSE;
   }
   foreach ($schema['fields'] as $field_name => $field_schema) {
 

+ 3 - 0
tripal_views/tripal_views.views.inc

@@ -394,6 +394,9 @@ function tripal_views_add_node_ids_to_view(&$view) {
 
 function tripal_views_views_data() {
 
+  // Make sure all chado tables are integrated
+  tripal_views_integrate_all_chado_tables();
+
   // Define Global Fields
   // Filter handler that lets the admin say:
   // "Show no results until they enter search parameters"