Browse Source

Merge branch '7.x-2.x' of git.drupal.org:sandbox/spficklin/1337878 into 7.x-2.x

Stephen Ficklin 11 years ago
parent
commit
e6bf3c8b95
1 changed files with 27 additions and 0 deletions
  1. 27 0
      tripal_organism/includes/tripal_organism.chado_node.inc

+ 27 - 0
tripal_organism/includes/tripal_organism.chado_node.inc

@@ -189,6 +189,15 @@ function chado_organism_insert($node) {
         'foreignkey_value' => $organism_id    // the value of the example_id key
       );
       chado_node_properties_form_update_properties($node, $details);
+
+      // * Additional DBxrefs Form *
+      $details = array(
+        'linking_table' => 'organism_dbxref',   // the name of your _dbxref table
+        'foreignkey_name' => 'organism_id',     // the name of the key in your base table
+        'foreignkey_value' => $organism_id      // the value of the organism_id key
+      );
+      chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+
     }
   }
   else {
@@ -251,6 +260,14 @@ function chado_organism_update($node) {
     'foreignkey_value' => $organism_id    // the value of the example_id key
   );
   chado_node_properties_form_update_properties($node, $details);
+
+  // * Additional DBxrefs Form *
+  $details = array(
+    'linking_table' => 'organism_dbxref',   // the name of your _dbxref table
+    'foreignkey_name' => 'organism_id',     // the name of the key in your base table
+    'foreignkey_value' => $organism_id      // the value of the organism_id key
+  );
+  chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
 }
 /**
  * Delete organism from both drupal and chado databases. Check dependency before
@@ -417,6 +434,16 @@ function chado_organism_form($node, $form_state) {
   // Adds the form elements to your current form
   chado_node_properties_form($form, $form_state, $details);
 
+  // ADDITIONAL DBXREFS FORM
+  //---------------------------------------------
+  $details = array(
+    'linking_table' => 'organism_dbxref',  // the name of the _dbxref table
+    'base_foreign_key' => 'organism_id',   // the name of the key in your base chado table
+    'base_key_value' => $organism_id       // the value of organism_id for this record
+  );
+  // Adds the form elements to your current form
+  chado_node_additional_dbxrefs_form($form, $form_state, $details);
+
   return $form;
 }