Browse Source

Moved Chado settings from field to instance

Stephen Ficklin 8 years ago
parent
commit
23e01ef2f4
52 changed files with 422 additions and 365 deletions
  1. 8 0
      tripal/includes/tripal.fields.inc
  2. 8 8
      tripal_chado/includes/TripalFields.old/chado_base__dbxref_id.inc
  3. 6 6
      tripal_chado/includes/TripalFields.old/chado_base__organism_id.inc
  4. 2 2
      tripal_chado/includes/TripalFields.old/chado_feature__md5checksum.inc
  5. 2 2
      tripal_chado/includes/TripalFields.old/chado_feature__residues.inc
  6. 4 4
      tripal_chado/includes/TripalFields.old/chado_feature__seqlen.inc
  7. 6 6
      tripal_chado/includes/TripalFields.old/chado_linker__contact.inc
  8. 8 8
      tripal_chado/includes/TripalFields.old/chado_linker__cvterm.inc
  9. 15 15
      tripal_chado/includes/TripalFields.old/chado_linker__dbxref.inc
  10. 2 2
      tripal_chado/includes/TripalFields.old/chado_linker__expression.inc
  11. 2 2
      tripal_chado/includes/TripalFields.old/chado_linker__genotype.inc
  12. 2 2
      tripal_chado/includes/TripalFields.old/chado_linker__phenotype.inc
  13. 9 9
      tripal_chado/includes/TripalFields.old/chado_linker__prop.inc
  14. 1 1
      tripal_chado/includes/TripalFields.old/chado_linker__prop_adder.inc
  15. 8 8
      tripal_chado/includes/TripalFields.old/chado_linker__pub.inc
  16. 13 13
      tripal_chado/includes/TripalFields.old/chado_linker__relationship.inc
  17. 10 10
      tripal_chado/includes/TripalFields.old/chado_linker__synonym.inc
  18. 4 4
      tripal_chado/includes/TripalFields.old/chado_organism__type_id.inc
  19. 2 2
      tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact.inc
  20. 4 4
      tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact_widget.inc
  21. 3 3
      tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm.inc
  22. 2 2
      tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm_formatter.inc
  23. 4 4
      tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm_widget.inc
  24. 3 3
      tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop.inc
  25. 1 1
      tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop_formatter.inc
  26. 5 5
      tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop_widget.inc
  27. 4 4
      tripal_chado/includes/TripalFields/data__accession/data__accession.inc
  28. 8 8
      tripal_chado/includes/TripalFields/data__accession/data__accession_widget.inc
  29. 8 8
      tripal_chado/includes/TripalFields/data__sequence/data__sequence_widget.inc
  30. 11 11
      tripal_chado/includes/TripalFields/data__sequence_checksum/data__sequence_checksum_widget.inc
  31. 9 9
      tripal_chado/includes/TripalFields/data__sequence_length/data__sequence_length_widget.inc
  32. 2 2
      tripal_chado/includes/TripalFields/go__gene_expression/go__gene_expression.inc
  33. 7 5
      tripal_chado/includes/TripalFields/obi__organism/obi__organism.inc
  34. 2 2
      tripal_chado/includes/TripalFields/obi__organism/obi__organism_widget.inc
  35. 8 8
      tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference.inc
  36. 1 1
      tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference_formatter.inc
  37. 12 12
      tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference_widget.inc
  38. 2 2
      tripal_chado/includes/TripalFields/sbo__phenotype/sbo__phenotype.inc
  39. 3 3
      tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship.inc
  40. 13 13
      tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship_widget.inc
  41. 3 3
      tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name.inc
  42. 1 1
      tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name_formatter.inc
  43. 6 6
      tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name_widget.inc
  44. 3 3
      tripal_chado/includes/TripalFields/schema__publication/schema__publication.inc
  45. 4 4
      tripal_chado/includes/TripalFields/schema__publication/schema__publication_widget.inc
  46. 2 2
      tripal_chado/includes/TripalFields/so__genotype/so__genotype.inc
  47. 2 2
      tripal_chado/includes/TripalFields/so__transcript/so__transcript.inc
  48. 2 2
      tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon.inc
  49. 2 2
      tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon_widget.inc
  50. 3 3
      tripal_chado/includes/tripal_chado.field_storage.inc
  51. 157 123
      tripal_chado/includes/tripal_chado.fields.inc
  52. 13 0
      tripal_chado/tripal_chado.module

+ 8 - 0
tripal/includes/tripal.fields.inc

@@ -379,6 +379,14 @@ function tripal_field_instance_settings_form_process($element, &$form_state, $fo
     ),
     $vocabulary . ':' . $accession
   );
+  $rows[] = array(
+    array(
+      'data' => 'Name',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $term['name']
+  );
   $rows[] = array(
     array(
       'data' => 'Definition',

+ 8 - 8
tripal_chado/includes/TripalFields.old/chado_base__dbxref_id.inc

@@ -45,8 +45,8 @@ class chado_base__dbxref_id extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the field defaults.
     $fk_val = '';
@@ -162,8 +162,8 @@ class chado_base__dbxref_id extends TripalField {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the field values.
     foreach ($items as $delta => $values) {
@@ -209,8 +209,8 @@ class chado_base__dbxref_id extends TripalField {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     $fk_val = isset($form_state['values'][$field_name][$langcode][$delta]['chado-' . $field_table . '__' . $field_column]) ? $form_state['values'][$field_name][$langcode][$delta]['chado-' . $field_table . '__' . $field_column] : '';
     $db_id = isset($form_state['values'][$field_name][$langcode][$delta]['db_id']) ? $form_state['values'][$field_name][$langcode][$delta]['db_id'] : '';
@@ -242,8 +242,8 @@ class chado_base__dbxref_id extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
 
     // Set some defauls for the empty record

+ 6 - 6
tripal_chado/includes/TripalFields.old/chado_base__organism_id.inc

@@ -53,8 +53,8 @@ class chado_base__organism_id extends TripalField {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     $organism_id = 0;
     if (count($items) > 0 and array_key_exists('chado-' . $field_table . '__organism_id', $items[0])) {
@@ -86,8 +86,8 @@ class chado_base__organism_id extends TripalField {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the field values.
     foreach ($items as $delta => $values) {
@@ -113,8 +113,8 @@ class chado_base__organism_id extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Set some defaults for the empty record.
     $entity->{$field_name}['und'][0] = array(

+ 2 - 2
tripal_chado/includes/TripalFields.old/chado_feature__md5checksum.inc

@@ -45,8 +45,8 @@ class chado_feature__md5checksum  extends TripalField {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the field defaults.
     $md5checksum = '';

+ 2 - 2
tripal_chado/includes/TripalFields.old/chado_feature__residues.inc

@@ -70,8 +70,8 @@ class chado_feature__residues extends TripalField {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the field defaults.
     $residues = '';

+ 4 - 4
tripal_chado/includes/TripalFields.old/chado_feature__seqlen.inc

@@ -41,8 +41,8 @@ class chado_feature__seqlen extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     $widget['value'] = array(
       '#type' => 'value',
@@ -65,8 +65,8 @@ class chado_feature__seqlen extends TripalField {
   public function widgetFormSubmit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the residues so we can calculate teh length.
     $residues = $form_state['values']['feature__residues']['und'][0]['chado-feature__residues'];

+ 6 - 6
tripal_chado/includes/TripalFields.old/chado_linker__contact.inc

@@ -86,8 +86,8 @@ class chado_linker__contact extends TripalField {
     $field_name = $this->field['field_name'];
 
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -157,8 +157,8 @@ class chado_linker__contact extends TripalField {
   public function widgetFormSubmit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
 
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -202,8 +202,8 @@ class chado_linker__contact extends TripalField {
     $record = $details['record'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 8 - 8
tripal_chado/includes/TripalFields.old/chado_linker__cvterm.inc

@@ -30,7 +30,7 @@ class chado_linker__cvterm extends TripalField {
     $headers = array('Term', 'Definition', 'Is Not', 'Reference');
     $rows = array();
 
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
     foreach ($items as $delta => $item) {
       if ($item['chado-' . $chado_table . '__cvterm_id']) {
         $cvterm = chado_generate_var('cvterm', array('cvterm_id' => $item['chado-' . $chado_table . '__cvterm_id']));
@@ -101,8 +101,8 @@ class chado_linker__cvterm extends TripalField {
     $cv_id = $matches[2];
 
     // Get the FK column that links to the base table.
-    $chado_table = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($chado_table);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -222,10 +222,10 @@ class chado_linker__cvterm extends TripalField {
   public function widgetFormSubmit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
 
     $field_name = $this->field['field_name'];
-    $table_name = $this->field['settings']['chado_table'];
+    $table_name = $this->instance['settings']['chado_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $lfkey_field = key($schema['foreign keys'][$base_table]['columns']);
     $rfkey_field = $schema['foreign keys'][$base_table]['columns'][$lfkey_field];
 
@@ -255,9 +255,9 @@ class chado_linker__cvterm extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     $matches = array();
     preg_match('/(.*?)__(\d+)/', $field_name, $matches);

+ 15 - 15
tripal_chado/includes/TripalFields.old/chado_linker__dbxref.inc

@@ -38,7 +38,7 @@ class chado_linker__dbxref extends TripalField {
    */
   public function formatterView(&$element, $entity_type, $entity, $langcode, $items, $display) {
 
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
     $content = '';
     foreach ($items as $delta => $item) {
       if (!$item['value']) {
@@ -70,12 +70,12 @@ class chado_linker__dbxref extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK column that links to the base table.
-    $chado_table = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($chado_table);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -203,10 +203,10 @@ class chado_linker__dbxref extends TripalField {
   public function validate($entity_type, $entity, $field, $items, &$errors) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $table_name = $this->field['settings']['chado_table'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -257,10 +257,10 @@ class chado_linker__dbxref extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $table_name = $this->field['settings']['chado_table'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -301,8 +301,8 @@ class chado_linker__dbxref extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
     $base_table = $record->tablename;
 
     $schema = chado_get_schema($field_table);

+ 2 - 2
tripal_chado/includes/TripalFields.old/chado_linker__expression.inc

@@ -103,8 +103,8 @@ class chado_linker__expression extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 2 - 2
tripal_chado/includes/TripalFields.old/chado_linker__genotype.inc

@@ -82,8 +82,8 @@ class chado_linker__genotype extends TripalField {
     $record = $details['record'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 2 - 2
tripal_chado/includes/TripalFields.old/chado_linker__phenotype.inc

@@ -82,8 +82,8 @@ class chado_linker__phenotype extends TripalField {
     $record = $details['record'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 9 - 9
tripal_chado/includes/TripalFields.old/chado_linker__prop.inc

@@ -27,7 +27,7 @@ class chado_linker__prop extends TripalField {
   public function formatterView(&$element, $entity_type, $entity, $langcode, $items, $display) {
 
     $field_name = $this->field['field_name'];
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
 
     $properties = array();
     foreach ($items as $delta => $item) {
@@ -50,8 +50,8 @@ class chado_linker__prop extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
     $instance = $this->instance;
 
     // Get the table name and cvterm that this field maps to.
@@ -69,7 +69,7 @@ class chado_linker__prop extends TripalField {
     // of the FK field that links to the base table.
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $lfkey_field = key($schema['foreign keys'][$base_table]['columns']);
     $rfkey_field = $schema['foreign keys'][$base_table]['columns'][$lfkey_field];
 
@@ -123,10 +123,10 @@ class chado_linker__prop extends TripalField {
   public function widgetFormSubmit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
 
     $field_name = $this->field['field_name'];
-    $table_name = $this->field['settings']['chado_table'];
+    $table_name = $this->instance['settings']['chado_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $lfkey_field = key($schema['foreign keys'][$base_table]['columns']);
     $rfkey_field = $schema['foreign keys'][$base_table]['columns'][$lfkey_field];
 
@@ -150,9 +150,9 @@ class chado_linker__prop extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     $matches = array();
     preg_match('/(.*?)__(\d+)/', $field_name, $matches);

+ 1 - 1
tripal_chado/includes/TripalFields.old/chado_linker__prop_adder.inc

@@ -216,7 +216,7 @@ class chado_linker__prop_adder extends TripalField {
     }
 
     // Get the table and base table.
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
 
     // Get the term for the property
     $field = $this->field;

+ 8 - 8
tripal_chado/includes/TripalFields.old/chado_linker__pub.inc

@@ -29,7 +29,7 @@ class chado_linker__pub extends TripalField {
   public function formatterView(&$element, $entity_type, $entity, $langcode, $items, $display) {
 
     $list_items = array();
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
     foreach ($items as $delta => $item) {
       if ($item['chado-' . $chado_table . '__pub_id']) {
         $pub = chado_generate_var('pub', array('pub_id' => $item['chado-' . $chado_table . '__pub_id']));
@@ -63,8 +63,8 @@ class chado_linker__pub extends TripalField {
     $field_name = $this->field['field_name'];
 
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -131,8 +131,8 @@ class chado_linker__pub extends TripalField {
   public function widgetFormSubmit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
 
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -177,9 +177,9 @@ class chado_linker__pub extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 13 - 13
tripal_chado/includes/TripalFields.old/chado_linker__relationship.inc

@@ -121,8 +121,8 @@ class chado_linker__relationship extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the instance settings
     $instance = $this->instance;
@@ -138,8 +138,8 @@ class chado_linker__relationship extends TripalField {
     $option1_test   = $option1_vocabs;
 
     // Get the FK column that links to the base table.
-    $chado_table = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($chado_table);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -427,9 +427,9 @@ class chado_linker__relationship extends TripalField {
   function validate($entity_type, $entity, $langcode, $items, &$errors) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     $schema = chado_get_schema($field_table);
     $fkeys = $schema['foreign keys'];
@@ -587,9 +587,9 @@ class chado_linker__relationship extends TripalField {
 return;
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
     $chado_record_id = $entity->chado_record_id;
 
     $schema = chado_get_schema($field_table);
@@ -651,9 +651,9 @@ return;
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     // Get the PKey for this table
     $schema = chado_get_schema($field_table);

+ 10 - 10
tripal_chado/includes/TripalFields.old/chado_linker__synonym.inc

@@ -27,7 +27,7 @@ class chado_linker__synonym extends TripalField {
    */
   public function formatterView(&$element, $entity_type, $entity, $langcode, $items, $display) {
 
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
     foreach ($items as $delta => $item) {
       if (array_key_exists('chado-' . $chado_table . '__synonym_id', $item) and
           $item['chado-' . $chado_table . '__synonym_id']) {
@@ -53,8 +53,8 @@ class chado_linker__synonym extends TripalField {
     $field_name = $this->field['field_name'];
 
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -169,10 +169,10 @@ class chado_linker__synonym extends TripalField {
   public function widgetFormSubmit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $table_name = $this->field['settings']['chado_table'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -228,12 +228,12 @@ class chado_linker__synonym extends TripalField {
   public function load($entity, $details = array()) {
 
     $record = $details['record'];
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the PKey for this table
     $schema = chado_get_schema($field_table);

+ 4 - 4
tripal_chado/includes/TripalFields.old/chado_organism__type_id.inc

@@ -31,8 +31,8 @@ class chado_organism__type_id extends TripalField {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     $type_id = 0;
     if (count($items) > 0 and array_key_exists('organism__type_id', $items[0])) {
@@ -71,8 +71,8 @@ class chado_organism__type_id extends TripalField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Set some defaults for the empty record.
     $entity->{$field_name}['und'][0] = array(

+ 2 - 2
tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact.inc

@@ -74,8 +74,8 @@ class chado_linker__contact extends ChadoField {
     $record = $details['record'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 4 - 4
tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact_widget.inc

@@ -18,8 +18,8 @@ class chado_linker__contact_widget extends ChadoFieldWidget {
     $field_name = $this->field['field_name'];
 
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -104,8 +104,8 @@ class chado_linker__contact_widget extends ChadoFieldWidget {
    */
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);

+ 3 - 3
tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm.inc

@@ -66,9 +66,9 @@ class chado_linker__cvterm extends ChadoField {
   public function load($entity, $details = array()) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     $vocabulary = $this->instance['settings']['term_vocabulary'];
     $accession = $this->instance['settings']['term_accession'];

+ 2 - 2
tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm_formatter.inc

@@ -16,7 +16,7 @@ class chado_linker__cvterm_formatter extends ChadoFieldFormatter {
     $headers = array('Term', 'Definition', 'Is Not', 'Reference');
     $rows = array();
 
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
     foreach ($items as $delta => $item) {
       if ($item['chado-' . $chado_table . '__cvterm_id']) {
         $cvterm = chado_generate_var('cvterm', array('cvterm_id' => $item['chado-' . $chado_table . '__cvterm_id']));
@@ -77,7 +77,7 @@ class chado_linker__cvterm_formatter extends ChadoFieldFormatter {
     $headers = array('Term', 'Definition', 'Is Not', 'Publication');
     $rows = array();
 
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
     foreach ($items as $delta => $item) {
       if ($item['chado-' . $chado_table . '__cvterm_id']) {
         $cvterm = chado_generate_var('cvterm', array('cvterm_id' => $item['chado-' . $chado_table . '__cvterm_id']));

+ 4 - 4
tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm_widget.inc

@@ -26,8 +26,8 @@ class chado_linker__cvterm_widget extends ChadoFieldWidget {
     $cv_id = $matches[2];
 
     // Get the FK column that links to the base table.
-    $chado_table = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($chado_table);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -164,10 +164,10 @@ class chado_linker__cvterm_widget extends ChadoFieldWidget {
    */
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
-    $table_name = $this->field['settings']['chado_table'];
+    $table_name = $this->instance['settings']['chado_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $lfkey_field = key($schema['foreign keys'][$base_table]['columns']);
     $rfkey_field = $schema['foreign keys'][$base_table]['columns'][$lfkey_field];
 

+ 3 - 3
tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop.inc

@@ -56,9 +56,9 @@ class chado_linker__prop extends ChadoField {
   public function load($entity, $details = array()) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     $vocabulary = $this->instance['settings']['term_vocabulary'];
     $accession = $this->instance['settings']['term_accession'];

+ 1 - 1
tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop_formatter.inc

@@ -22,7 +22,7 @@ class chado_linker__prop_formatter extends ChadoFieldFormatter {
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
     $field_name = $this->field['field_name'];
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
 
     $properties = array();
     foreach ($items as $delta => $item) {

+ 5 - 5
tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop_widget.inc

@@ -16,15 +16,15 @@ class chado_linker__prop_widget extends ChadoFieldWidget {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
     $instance = $this->instance;
 
     // Get the name of the pkey field for this property table and the name
     // of the FK field that links to the base table.
     $schema = chado_get_schema($field_table);
     $pkey = $schema['primary key'][0];
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $lfkey_field = key($schema['foreign keys'][$base_table]['columns']);
     $rfkey_field = $schema['foreign keys'][$base_table]['columns'][$lfkey_field];
 
@@ -105,10 +105,10 @@ class chado_linker__prop_widget extends ChadoFieldWidget {
    */
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
-    $field_table = $this->field['settings']['chado_table'];
+    $field_table = $this->instance['settings']['chado_table'];
     $schema = chado_get_schema($field_table);
     $pkey = $schema['primary key'][0];
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $lfkey_field = key($schema['foreign keys'][$base_table]['columns']);
     $rfkey_field = $schema['foreign keys'][$base_table]['columns'][$lfkey_field];
 

+ 4 - 4
tripal_chado/includes/TripalFields/data__accession/data__accession.inc

@@ -53,8 +53,8 @@ class data__accession extends ChadoField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
 
     // Set some defauls for the empty record
@@ -100,8 +100,8 @@ class data__accession extends ChadoField {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the field values.
     foreach ($items as $delta => $values) {

+ 8 - 8
tripal_chado/includes/TripalFields/data__accession/data__accession_widget.inc

@@ -14,8 +14,8 @@ class data__accession_widget extends ChadoFieldWidget {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the field defaults.
     $fk_val = '';
@@ -129,8 +129,8 @@ class data__accession_widget extends ChadoFieldWidget {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     $fk_val = isset($form_state['values'][$field_name][$langcode][$delta]['chado-' . $field_table . '__' . $field_column]) ? $form_state['values'][$field_name][$langcode][$delta]['chado-' . $field_table . '__' . $field_column] : '';
     $db_id = isset($form_state['values'][$field_name][$langcode][$delta]['db_id']) ? $form_state['values'][$field_name][$langcode][$delta]['db_id'] : '';
@@ -161,8 +161,8 @@ function data__accession_widget_form_ajax_callback($form, $form_state) {
   $field_name = $form_state['triggering_element']['#parents'][0];
   $field = field_info_field($field_name);
   $field_type = $field['type'];
-  $field_table = $field['settings']['chado_table'];
-  $field_column = $field['settings']['chado_column'];
+  $field_table = $this->instance['settings']['chado_table'];
+  $field_column = $this->instance['settings']['chado_column'];
   $field_prefix = 'chado-' . $field_table . '__' . $field_column;
 
   //   $db_id = tripal_chado_get_field_form_values($field_name, $form_state, 0, $field_prefix . '--db_id');
@@ -187,8 +187,8 @@ function theme_data__accession_widget($variables) {
   $field_name = $element['#field_name'];
   $field = field_info_field($field_name);
   $field_type = $field['type'];
-  $field_table = $field['settings']['chado_table'];
-  $field_column = $field['settings']['chado_column'];
+  $field_table = $this->instant['settings']['chado_table'];
+  $field_column = $this->instant['settings']['chado_column'];
   $field_prefix = 'chado-' . $field_table . '__' . $field_column;
 
   $layout = "

+ 8 - 8
tripal_chado/includes/TripalFields/data__sequence/data__sequence_widget.inc

@@ -8,18 +8,18 @@ class data__sequence_widget extends ChadoFieldWidget {
   public static $field_types = array('data__sequence');
 
   /**
-   * 
+   *
    * @see TripalFieldWidget::form()
    */
   public function form(&$widget, &$form, &$form_state, $langcode, $items, $delta, $element) {
     parent::form($widget, $form, $form_state, $langcode, $items, $delta, $element);
-    
+
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+
     // Get the field defaults.
     $residues = '';
     if (count($items) > 0 and array_key_exists('chado-feature__residues', $items[0])) {
@@ -28,7 +28,7 @@ class data__sequence_widget extends ChadoFieldWidget {
     if (array_key_exists('values', $form_state)) {
       //$residues = tripal_chado_get_field_form_values($field_name, $form_state, 0, 'feature__residues');
     }
-    
+
     $widget['value'] = array(
       '#type' => 'value',
       '#value' => array_key_exists($delta, $items) ? $items[$delta]['value'] : '',
@@ -60,12 +60,12 @@ class data__sequence_widget extends ChadoFieldWidget {
 
 
   /**
-   * 
+   *
    * @see TripalFieldWidget::submit()
    */
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
-    
+
     // Remove any white spaces.
     $residues = isset($form_state['values'][$field_name][$langcode][$delta]['chado-feature__residues']) ? $form_state['values'][$field_name][$langcode][$delta]['chado-feature__residues'] : '';
     if ($residues) {

+ 11 - 11
tripal_chado/includes/TripalFields/data__sequence_checksum/data__sequence_checksum_widget.inc

@@ -8,24 +8,24 @@ class data__sequence_checksum_widget extends ChadoFieldWidget {
   public static $field_types = array('data__sequence_checksum');
 
   /**
-   * 
+   *
    * @see TripalFieldWidget::form()
    */
   public function form(&$widget, &$form, &$form_state, $langcode, $items, $delta, $element) {
     parent::form($widget, $form, $form_state, $langcode, $items, $delta, $element);
-    
+
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+
     // Get the field defaults.
     $md5checksum = '';
     if (count($items) > 0 and array_key_exists('chado-feature__md5checksum', $items[0])) {
       $md5checksum = $items[0]['chado-feature__md5checksum'];
     }
-    
+
     $widget['value'] = array(
       '#type' => 'value',
       '#value' => $md5checksum,
@@ -52,7 +52,7 @@ class data__sequence_checksum_widget extends ChadoFieldWidget {
 
 
   /**
-   * 
+   *
    * @see TripalFieldWidget::submit()
    */
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
@@ -60,12 +60,12 @@ class data__sequence_checksum_widget extends ChadoFieldWidget {
     $settings = $field['settings'];
     $field_name = $field['field_name'];
     $field_type = $field['type'];
-    $field_table = $field['settings']['chado_table'];
-    $field_column = $field['settings']['chado_column'];
-    
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+
     // Get the residues so we can calculate teh length.
     $residues = isset($form_state['values']['feature__residues'][$langcode][0]['chado-feature__residues']) ? $form_state['values']['feature__residues'][$langcode][0]['chado-feature__residues'] : '';
-    
+
     if ($residues) {
       // Remove spaces and new lines from the residues string.
       $residues = preg_replace('/\s/', '', $residues);

+ 9 - 9
tripal_chado/includes/TripalFields/data__sequence_length/data__sequence_length_widget.inc

@@ -8,21 +8,21 @@ class data__sequence_length_widget extends ChadoFieldWidget {
   public static $field_types = array('data__sequence_length');
 
   /**
-   * 
+   *
    * @see TripalFieldWidget::form()
    */
   public function form(&$widget, &$form, &$form_state, $langcode, $items, $delta, $element) {
     parent::form($widget, $form, $form_state, $langcode, $items, $delta, $element);
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+
     $widget['value'] = array(
       '#type' => 'value',
       '#value' => array_key_exists($delta, $items) ? $items[$delta]['value'] : '',
     );
-    
+
     $widget['chado-feature__seqlen'] =  array(
       '#type' => 'value',
       '#value' => 0,
@@ -49,15 +49,15 @@ class data__sequence_length_widget extends ChadoFieldWidget {
 
 
   /**
-   * 
+   *
    * @see TripalFieldWidget::submit()
    */
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+
     // Get the residues so we can calculate teh length.
     $residues = $form_state['values']['feature__residues']['und'][0]['chado-feature__residues'];
     // Remove any white spaces.

+ 2 - 2
tripal_chado/includes/TripalFields/go__gene_expression/go__gene_expression.inc

@@ -77,8 +77,8 @@ class go__gene_expression extends ChadoField {
     $record = $details['record'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 7 - 5
tripal_chado/includes/TripalFields/obi__organism/obi__organism.inc

@@ -26,6 +26,8 @@ class obi__organism extends ChadoField {
     // type. This will create form elements when editing the field instance
     // to allow the site admin to change the term settings above.
     'term_fixed' => TRUE,
+    // The format for display of the organism.
+    'field_display_string' => '<i>[organism.genus] [organism.species]</i>',
   );
 
   // The default widget for this field.
@@ -43,8 +45,8 @@ class obi__organism extends ChadoField {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the field values.
     foreach ($items as $delta => $values) {
@@ -66,12 +68,12 @@ class obi__organism extends ChadoField {
   public function load($entity, $details = array()) {
 
     $record = $details['record'];
-    $settings = $this->field['settings'];
+    $settings = $this->instance['settings'];
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the terms for each of the keys for the 'values' property.
     $label_term = 'rdfs:label';

+ 2 - 2
tripal_chado/includes/TripalFields/obi__organism/obi__organism_widget.inc

@@ -19,8 +19,8 @@ class obi__organism_widget extends ChadoFieldWidget {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     $organism_id = 0;
     if (count($items) > 0 and array_key_exists('chado-' . $field_table . '__organism_id', $items[0])) {

+ 8 - 8
tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference.inc

@@ -75,20 +75,20 @@ class sbo__database_cross_reference extends ChadoField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
     $base_table = $record->tablename;
 
     $schema = chado_get_schema($field_table);
     $pkey = $schema['primary key'][0];
-    $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
-    $fkey = $fkeys[0];
+    $fkey_lcolumn = key($schema['foreign keys'][$base_table]['columns']);
+    $fkey_rcolumn = $schema['foreign keys'][$base_table]['columns'][$fkey_lcolumn];
 
     // Set some defaults for the empty record.
     $entity->{$field_name}['und'][0] = array(
       'value' => array(),
       'chado-' . $field_table . '__' . $pkey => '',
-      'chado-' . $field_table . '__' . $fkey => '',
+      'chado-' . $field_table . '__' . $fkey_lcolumn => '',
       'chado-' . $field_table . '__dbxref_id' => '',
       'dbxref_id' => '',
       'db_id' => '',
@@ -112,7 +112,7 @@ class sbo__database_cross_reference extends ChadoField {
             'URL' => $URL,
           ),
           'chado-' . $field_table . '__' . $pkey => $linker->$pkey,
-          'chado-' . $field_table . '__' . $fkey => $linker->$fkey->$fkey,
+          'chado-' . $field_table . '__' . $fkey_lcolumn => $linker->$fkey_lcolumn->$fkey_lcolumn,
           'chado-' . $field_table . '__dbxref_id' => $dbxref->dbxref_id,
           'dbxref_id' => $dbxref->dbxref_id,
           'db_id' => $dbxref->db_id->db_id,
@@ -169,8 +169,8 @@ function sbo__database_cross_reference_widget_form_ajax_callback($form, $form_st
   $delta = $form_state['triggering_element']['#parents'][2];
   $field = field_info_field($field_name);
   $field_type = $field['type'];
-  $field_table = $field['settings']['chado_table'];
-  $field_column = $field['settings']['chado_column'];
+  $field_table = $this->instance['settings']['chado_table'];
+  $field_column = $this->instance['settings']['chado_column'];
   $field_prefix = 'chado-' . $field_table . '__dbxref_id';
 
   // Check to see if this dbxref already exists. If not then

+ 1 - 1
tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference_formatter.inc

@@ -20,7 +20,7 @@ class sbo__database_cross_reference_formatter extends ChadoFieldFormatter {
    * @see TripalFieldFormatter::view()
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
     $content = '';
     foreach ($items as $delta => $item) {
       if (!$item['value']) {

+ 12 - 12
tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference_widget.inc

@@ -15,12 +15,12 @@ class sbo__database_cross_reference_widget extends ChadoFieldWidget {
     parent::form($widget, $form, $form_state, $langcode, $items, $delta, $element);
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK column that links to the base table.
-    $chado_table = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($chado_table);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -155,10 +155,10 @@ class sbo__database_cross_reference_widget extends ChadoFieldWidget {
   public function validate($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $table_name = $this->field['settings']['chado_table'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -211,10 +211,10 @@ class sbo__database_cross_reference_widget extends ChadoFieldWidget {
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $table_name = $this->field['settings']['chado_table'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);

+ 2 - 2
tripal_chado/includes/TripalFields/sbo__phenotype/sbo__phenotype.inc

@@ -74,8 +74,8 @@ class sbo__phenotype extends ChadoField {
     $record = $details['record'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 3 - 3
tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship.inc

@@ -75,9 +75,9 @@ class sbo__relationship extends ChadoField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     // Get the PKey for this table
     $schema = chado_get_schema($field_table);

+ 13 - 13
tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship_widget.inc

@@ -18,12 +18,12 @@ class sbo__relationship_widget extends ChadoFieldWidget {
     $entity = $form['#entity'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     // Get the FK column that links to the base table.
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($field_table);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -115,7 +115,7 @@ class sbo__relationship_widget extends ChadoFieldWidget {
       $type = $form_state['values'][$field_name]['und'][$delta]['type_name'];
     }
    $widget['#table_name'] = $chado_table;
-    
+
     $widget['#fkeys'] = $schema['foreign keys'];
     $widget['#base_table'] = $base_table;
     $widget['#chado_record_id'] = isset($form['#entity']) ? $form['#entity']->chado_record_id : '';
@@ -341,9 +341,9 @@ class sbo__relationship_widget extends ChadoFieldWidget {
   public function validate($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     $schema = chado_get_schema($field_table);
     $fkeys = $schema['foreign keys'];
@@ -499,9 +499,9 @@ class sbo__relationship_widget extends ChadoFieldWidget {
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
     $chado_record_id = $entity->chado_record_id;
 
     $schema = chado_get_schema($field_table);
@@ -575,8 +575,8 @@ function theme_sbo__relationship_widget($variables) {
   $field_name = $element['#field_name'];
   $field = field_info_field($field_name);
   $field_type = $field['type'];
-  $field_table = $field['settings']['chado_table'];
-  $field_column = $field['settings']['chado_column'];
+  $field_table = $this->instance['settings']['chado_table'];
+  $field_column = $this->instance['settings']['chado_column'];
   $layout = "
       <div class=\"chado-linker--relationship-widget\">
         <div class=\"chado-linker--relationship-widget-item\">" .

+ 3 - 3
tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name.inc

@@ -70,12 +70,12 @@ class schema__alternate_name extends ChadoField {
    */
   public function load($entity, $details = array()) {
     $record = $details['record'];
-    $base_table = $this->field['settings']['base_table'];
+    $base_table = $this->instance['settings']['base_table'];
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the PKey for this table
     $schema = chado_get_schema($field_table);

+ 1 - 1
tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name_formatter.inc

@@ -20,7 +20,7 @@ class schema__alternate_name_formatter extends ChadoFieldFormatter {
    * @see TripalFieldFormatter::view()
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
-    $chado_table = $this->field['settings']['chado_table'];
+    $chado_table = $this->instance['settings']['chado_table'];
     foreach ($items as $delta => $item) {
       if (array_key_exists('chado-' . $chado_table . '__synonym_id', $item) and
           $item['chado-' . $chado_table . '__synonym_id']) {

+ 6 - 6
tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name_widget.inc

@@ -17,8 +17,8 @@ class schema__alternate_name_widget extends ChadoFieldWidget {
     $field_name = $this->field['field_name'];
 
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -149,10 +149,10 @@ class schema__alternate_name_widget extends ChadoFieldWidget {
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $table_name = $this->field['settings']['chado_table'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);

+ 3 - 3
tripal_chado/includes/TripalFields/schema__publication/schema__publication.inc

@@ -75,9 +75,9 @@ class schema__publication extends ChadoField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
-    $base_table = $this->field['settings']['base_table'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
+    $base_table = $this->instance['settings']['base_table'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 4 - 4
tripal_chado/includes/TripalFields/schema__publication/schema__publication_widget.inc

@@ -17,8 +17,8 @@ class schema__publication_widget extends ChadoFieldWidget {
     $field_name = $this->field['field_name'];
     
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);
@@ -100,8 +100,8 @@ class schema__publication_widget extends ChadoFieldWidget {
    */
   public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     // Get the FK column that links to the base table.
-    $table_name = $this->field['settings']['chado_table'];
-    $base_table = $this->field['settings']['base_table'];
+    $table_name = $this->instance['settings']['chado_table'];
+    $base_table = $this->instance['settings']['base_table'];
     $schema = chado_get_schema($table_name);
     $pkey = $schema['primary key'][0];
     $fkeys = array_values($schema['foreign keys'][$base_table]['columns']);

+ 2 - 2
tripal_chado/includes/TripalFields/so__genotype/so__genotype.inc

@@ -73,8 +73,8 @@ class so__genotype extends ChadoField {
     $record = $details['record'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);

+ 2 - 2
tripal_chado/includes/TripalFields/so__transcript/so__transcript.inc

@@ -73,8 +73,8 @@ class so__transcript extends ChadoField {
     $record = $details['record'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Set some defaults for the empty record.
     $entity->{$field_name}['und'][0] = array(

+ 2 - 2
tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon.inc

@@ -74,8 +74,8 @@ class taxrank__infraspecific_taxon extends ChadoField {
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
 
     // Set some defaults for the empty record.
     $entity->{$field_name}['und'][0] = array(

+ 2 - 2
tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon_widget.inc

@@ -16,8 +16,8 @@ class taxrank__infraspecific_taxon_widget extends ChadoFieldWidget {
     $settings = $this->field['settings'];
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
-    $field_table = $this->field['settings']['chado_table'];
-    $field_column = $this->field['settings']['chado_column'];
+    $field_table = $this->instance['settings']['chado_table'];
+    $field_column = $this->instance['settings']['chado_column'];
     
     $type_id = 0;
     if (count($items) > 0 and array_key_exists('organism__type_id', $items[0])) {

+ 3 - 3
tripal_chado/includes/tripal_chado.field_storage.inc

@@ -240,13 +240,13 @@ function tripal_chado_field_storage_load($entity_type, $entities, $age,
       $instance = field_info_instance($entity_type, $field_name, $entity->bundle);
 
       // Skip fields that don't map to a Chado table (e.g. kvproperty_adder).
-      if (!array_key_exists('settings', $field) or !array_key_exists('chado_table', $field['settings'])) {
+      if (!array_key_exists('settings', $instance) or !array_key_exists('chado_table', $instance['settings'])) {
         continue;
       }
 
       // Get the Chado table and column for this field.
-      $field_table = $field['settings']['chado_table'];
-      $field_column = $field['settings']['chado_column'];
+      $field_table = $instance['settings']['chado_table'];
+      $field_column = $instance['settings']['chado_column'];
 
       // There are only two types of fields: 1) fields that represent a single
       // column of the base table, or 2) fields that represent a linked record

+ 157 - 123
tripal_chado/includes/tripal_chado.fields.inc

@@ -135,11 +135,6 @@ function tripal_chado_bundle_create_fields_base(&$info, $details, $entity_type,
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $table_name,
-        'chado_column' => $column_name,
-        'base_table' => $table_name,
-      ),
     );
 
     // Alter the field info array depending on the column details.
@@ -235,11 +230,6 @@ function tripal_chado_bundle_create_fields_custom(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $table_name,
-        'chado_column' => 'organism_id',
-        'base_table' => $table_name,
-      ),
     );
   }
 
@@ -255,12 +245,6 @@ function tripal_chado_bundle_create_fields_custom(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $table_name,
-        'chado_column' => 'dbxref_id',
-        'base_table' => $table_name,
-        'semantic_web' => tripal_get_chado_semweb_term($table_name, 'dbxref_id'),
-      ),
     );
   }
 
@@ -276,12 +260,6 @@ function tripal_chado_bundle_create_fields_custom(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $table_name,
-        'chado_column' => 'md5checksum',
-        'base_table' => $table_name,
-        'semantic_web' => tripal_get_chado_semweb_term($table_name, 'md5checksum'),
-      ),
     );
   }
 
@@ -297,11 +275,6 @@ function tripal_chado_bundle_create_fields_custom(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $table_name,
-        'chado_column' => 'residues',
-        'base_table' => $table_name,
-      ),
     );
   }
 
@@ -317,11 +290,6 @@ function tripal_chado_bundle_create_fields_custom(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $table_name,
-        'chado_column' => 'seqlen',
-        'base_table' => $table_name,
-      ),
     );
   }
 
@@ -338,11 +306,6 @@ function tripal_chado_bundle_create_fields_custom(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $rel_table,
-        'chado_column' => '',
-        'base_table' => $table_name,
-      ),
     );
   }
 
@@ -359,8 +322,6 @@ function tripal_chado_bundle_create_fields_custom(&$info, $details, $entity_type
 //         'type' => 'field_chado_storage',
 //       ),
 //       'settings' => array(
-//         'chado_table' => 'organism',
-//         'chado_column' => 'type_id',
 //       ),
 //     );
 //   }
@@ -393,20 +354,12 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $contact_table,
-        'base_table' => $table_name,
-        'chado_column' => 'contact_id',
-      ),
     );
   }
 
   // DBXREF
   $dbxref_table = $table_name . '_dbxref';
   if (chado_table_exists($dbxref_table)) {
-    $dbxref_table = $table_name . '_dbxref';
-    $schema = chado_get_schema($dbxref_table);
-    $pkey = $schema['primary key'][0];
     $field_name = 'sbo__database_cross_reference';
     $field_type = 'sbo__database_cross_reference';
     $info[$field_name] = array(
@@ -417,19 +370,12 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $dbxref_table,
-        'chado_column' => $pkey,
-        'base_table' => $table_name,
-      ),
     );
   }
 
   // EXPRESSION
   $expression_table = $table_name . '_expression';
   if (chado_table_exists($expression_table)) {
-    $schema = chado_get_schema($expression_table);
-    $pkey = $schema['primary key'][0];
     $field_name = 'go__gene_expression';
     $field_type = 'go__gene_expression';
     $info[$field_name] = array(
@@ -440,18 +386,11 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $expression_table,
-        'chado_column' => $pkey,
-        'base_table' => $table_name,
-      ),
     );
   }
 
   // FEATURELOC
   if ($table_name == 'feature') {
-    $schema = chado_get_schema('featureloc');
-    $pkey = $schema['primary key'][0];
     $field_name = 'data__sequence_coordinates';
     $field_type = 'data__sequence_coordinates';
     $info[$field_name] = array(
@@ -462,18 +401,11 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => 'featureloc',
-        'chado_column' => $pkey,
-        'base_table' => 'feature',
-      ),
     );
   }
 
   // FEATUREPOS
   if ($table_name == 'feature') {
-    $schema = chado_get_schema('featurepos');
-    $pkey = $schema['primary key'][0];
     $field_name = 'ogi__location_on_map';
     $field_type = 'ogi__location_on_map';
     $info[$field_name] = array(
@@ -484,19 +416,12 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => 'featurepos',
-        'chado_column' => $pkey,
-        'base_table' => 'feature',
-      ),
     );
   }
 
   // GENOTYPE
   $genotype_table = $table_name . '_genotype';
   if (chado_table_exists($genotype_table)) {
-    $schema = chado_get_schema($genotype_table);
-    $pkey = $schema['primary key'][0];
     $field_name = 'so__genotype';
     $field_type = 'so__genotype';
     $info[$field_name] = array(
@@ -507,19 +432,12 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $genotype_table,
-        'chado_column' => $pkey,
-        'base_table' => $table_name,
-      ),
     );
   }
 
   // PHENOTYPE
   $phenotype_table = $table_name . '_phenotype';
   if (chado_table_exists($phenotype_table)) {
-    $schema = chado_get_schema($phenotype_table);
-    $pkey = $schema['primary key'][0];
     $field_name = 'sbo__phenotype';
     $field_type = 'sbo__phenotype';
     $info[$field_name] = array(
@@ -530,11 +448,6 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $phenotype_table,
-        'chado_column' => $pkey,
-        'base_table' => $table_name,
-      ),
     );
   }
 
@@ -544,11 +457,9 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
     // Get the list of existing property types for this table.
     $sql = 'SELECT DISTINCT type_id FROM {' . $prop_table . '}';
     $props = chado_query($sql);
-    $schema = chado_get_schema($prop_table);
-    $pkey = $schema['primary key'][0];
     while ($prop = $props->fetchObject()) {
       $term = chado_generate_var('cvterm', array('cvterm_id' => $prop->type_id));
-      $field_name = strtolower($term->dbxref_id->db_id->name . '__' . $term->name);
+      $field_name = strtolower(preg_replace('/[^\w]/','_', $term->dbxref_id->db_id->name . '__' . $term->name));
       $field_type = 'chado_linker__prop';
       $info[$field_name] = array(
         'field_name' => $field_name,
@@ -558,11 +469,6 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
         'storage' => array(
           'type' => 'field_chado_storage',
         ),
-        'settings' => array(
-          'base_table' => $table_name,
-          'chado_table' => $prop_table,
-          'chado_column' => $pkey,
-        ),
       );
     }
   }
@@ -570,8 +476,6 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
   // PUBLICATIONS
   $pub_table = $table_name . '_pub';
   if (chado_table_exists($pub_table)) {
-    $schema = chado_get_schema($pub_table);
-    $pkey = $schema['primary key'][0];
     $field_name = 'schema__publication';
     $field_type = 'schema__publication';
     $info[$field_name] =  array(
@@ -582,11 +486,6 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $pub_table,
-        'chado_column' => $pkey,
-        'base_table' => $table_name,
-      ),
     );
   }
 
@@ -594,8 +493,6 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
   // If the linker table does not exists then we don't want to add attach.
   $rel_table = $table_name . '_relationship';
   if (chado_table_exists($rel_table)) {
-    $schema = chado_get_schema($rel_table);
-    $pkey = $schema['primary key'][0];
     $field_name = 'sbo__relationship';
     $field_type = 'sbo__relationship';
     $info[$field_name] =  array(
@@ -606,19 +503,12 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
       'storage' => array(
         'type' => 'field_chado_storage',
       ),
-      'settings' => array(
-        'chado_table' => $rel_table,
-        'chado_column' => $pkey,
-        'base_table' => $table_name,
-      ),
     );
   }
 
   // SYNONYMS
   $syn_table = $table_name . '_synonym';
   if (chado_table_exists($syn_table)) {
-    $schema = chado_get_schema($syn_table);
-    $pkey = $schema['primary key'][0];
     $field_name = 'schema__alternate_name';
     $field_type = 'schema__alternate_name';
     $info[$field_name] =  array(
@@ -630,9 +520,6 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
         'type' => 'field_chado_storage',
       ),
       'settings' => array(
-        'chado_table' => $syn_table,
-        'chado_column' => $pkey,
-        'base_table' => $table_name,
       ),
     );
   }
@@ -745,6 +632,9 @@ function tripal_chado_bundle_create_instances_base(&$info, $entity_type, $bundle
         'term_vocabulary' => $cvterm->dbxref_id->db_id->name,
         'term_name' => $cvterm->name,
         'term_accession' => $cvterm->dbxref_id->accession,
+        'chado_table' => $table_name,
+        'chado_column' => $column_name,
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'settings' => array(
@@ -906,6 +796,9 @@ function tripal_chado_bundle_create_instances_custom(&$info, $entity_type, $bund
       'required' => $is_required,
       'settings' => array(
         'auto_attach' => TRUE,
+        'chado_table' => $table_name,
+        'chado_column' => 'organism_id',
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'obi__organism_widget',
@@ -936,6 +829,9 @@ function tripal_chado_bundle_create_instances_custom(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => TRUE,
+        'chado_table' => $table_name,
+        'chado_column' => 'dbxref_id',
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'data__accession_widget',
@@ -969,6 +865,9 @@ function tripal_chado_bundle_create_instances_custom(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => TRUE,
+        'chado_table' => $table_name,
+        'chado_column' => 'md5checksum',
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'data__sequence_checksum_widget',
@@ -999,6 +898,9 @@ function tripal_chado_bundle_create_instances_custom(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $table_name,
+        'chado_column' => 'residues',
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'data__sequence_widget',
@@ -1031,6 +933,9 @@ function tripal_chado_bundle_create_instances_custom(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => TRUE,
+        'chado_table' => $table_name,
+        'chado_column' => 'seqlen',
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'data__sequence_length_widget',
@@ -1061,6 +966,9 @@ function tripal_chado_bundle_create_instances_custom(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $rel_table,
+        'chado_column' => '',
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'so__transcript_widget',
@@ -1090,6 +998,9 @@ function tripal_chado_bundle_create_instances_custom(&$info, $entity_type, $bund
 //       'required' => FALSE,
 //       'settings' => array(
 //         'auto_attach' => TRUE,
+//         'chado_table' => 'organism',
+//         'chado_column' => 'type_id',
+//         'base_table' => 'organism',
 //       ),
 //       'widget' => array(
 //         'type' => 'taxarank__infraspecific_taxon_widget',
@@ -1135,6 +1046,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $contact_table,
+        'base_table' => $table_name,
+        'chado_column' => 'contact_id',
       ),
       'widget' => array(
         'type' => 'local__contact_widget',
@@ -1144,7 +1058,7 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       ),
       'display' => array(
         'default' => array(
-          'label' => 'inline',
+          'label' => 'above',
           'type' => 'local__contact_formatter',
           'settings' => array(),
         ),
@@ -1156,6 +1070,8 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
   $dbxref_table = $table_name . '_dbxref';
   if (chado_table_exists($dbxref_table)) {
     $field_name = 'sbo__database_cross_reference';
+    $schema = chado_get_schema($dbxref_table);
+    $pkey = $schema['primary key'][0];
     $info[$field_name] =  array(
       'field_name' =>  $field_name,
       'entity_type' => $entity_type,
@@ -1165,6 +1081,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $dbxref_table,
+        'chado_column' => $pkey,
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'sbo__database_cross_reference_widget',
@@ -1186,6 +1105,8 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
   $expression_table = $table_name . '_expression';
   if (chado_table_exists($expression_table)) {
     $field_name = 'go__gene_expression';
+    $schema = chado_get_schema($expression_table);
+    $pkey = $schema['primary key'][0];
     $info[$field_name] = array(
       'field_name' => $field_name,
       'entity_type' => $entity_type,
@@ -1195,6 +1116,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $expression_table,
+        'chado_column' => $pkey,
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'go__gene_expression_widget',
@@ -1215,6 +1139,8 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
   // FEATURELOC
   if ($table_name == 'feature') {
     $field_name = 'data__sequence_coordinates';
+    $schema = chado_get_schema('featureloc');
+    $pkey = $schema['primary key'][0];
     $info[$field_name] = array(
       'field_name' => $field_name,
       'entity_type' => $entity_type,
@@ -1225,6 +1151,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => 'featureloc',
+        'chado_column' => $pkey,
+        'base_table' => 'feature',
       ),
       'widget' => array(
         'type' => 'data__sequence_coordinates_widget',
@@ -1245,6 +1174,8 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
   // FEATUREPOS
   if ($table_name == 'feature') {
     $field_name = 'ogi__location_on_map';
+    $schema = chado_get_schema('featurepos');
+    $pkey = $schema['primary key'][0];
     $info[$field_name] = array(
       'field_name' => $field_name,
       'entity_type' => $entity_type,
@@ -1254,6 +1185,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => 'featurepos',
+        'chado_column' => $pkey,
+        'base_table' => 'feature',
       ),
       'widget' => array(
         'type' => 'ogi__location_on_map_widget',
@@ -1275,6 +1209,8 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
   $genotype_table = $table_name . '_genotype';
   if (chado_table_exists($genotype_table)) {
     $field_name = 'so__genotype';
+    $schema = chado_get_schema($genotype_table);
+    $pkey = $schema['primary key'][0];
     $info[$field_name] = array(
       'field_name' => $field_name,
       'entity_type' => $entity_type,
@@ -1284,6 +1220,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $genotype_table,
+        'chado_column' => $pkey,
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'so__genotype_widget',
@@ -1305,6 +1244,8 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
   $phenotype_table = $table_name . '_phenotype';
   if (chado_table_exists($phenotype_table)) {
     $field_name = 'sbo__phenotype';
+    $schema = chado_get_schema($phenotype_table);
+    $pkey = $schema['primary key'][0];
     $info[$field_name] = array(
       'field_name' => $field_name,
       'entity_type' => $entity_type,
@@ -1314,6 +1255,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $phenotype_table,
+        'chado_column' => $pkey,
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'sbo__phenotype_widget',
@@ -1331,17 +1275,17 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
     );
   }
 
-  // TODO: we need to add a property for each type that already exists
-  // in the prop table.
-   // PROPERTIES
-   $prop_table = $table_name . 'prop';
-   if (chado_table_exists($prop_table)) {
+  // PROPERTIES
+  $prop_table = $table_name . 'prop';
+  if (chado_table_exists($prop_table)) {
      // Get the list of existing property types for this table.
      $sql = 'SELECT DISTINCT type_id FROM {' . $prop_table . '}';
      $props = chado_query($sql);
+     $schema = chado_get_schema($prop_table);
+     $pkey = $schema['primary key'][0];
      while ($prop = $props->fetchObject()) {
        $term = chado_generate_var('cvterm', array('cvterm_id' => $prop->type_id));
-       $field_name = strtolower($term->dbxref_id->db_id->name . '__' . $term->name);
+       $field_name = strtolower(preg_replace('/[^\w]/','_', $term->dbxref_id->db_id->name . '__' . $term->name));
        $info[$field_name] = array(
          'field_name' => $field_name,
          'entity_type' => $entity_type,
@@ -1354,6 +1298,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
            'term_vocabulary' => $term->dbxref_id->db_id->name,
            'term_accession' => $term->dbxref_id->accession,
            'term_name' => $term->name,
+           'base_table' => $table_name,
+           'chado_table' => $prop_table,
+           'chado_column' => $pkey,
          ),
          'widget' => array(
            'type' => 'chado_linker__prop_widget',
@@ -1377,16 +1324,20 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
   $pub_table = $table_name . '_pub';
   if (chado_table_exists($pub_table)) {
     $field_name = 'schema__publication';
+    $schema = chado_get_schema($pub_table);
+    $pkey = $schema['primary key'][0];
     $info[$field_name] = array(
       'field_name' => $field_name,
       'entity_type' => $entity_type,
       'bundle' => $bundle->name,
       'label' => 'Publication',
-      'description' => 'This record has been referenced or is sourced from
-        these publications.',
+      'description' => 'This record has been referenced or is sourced from these publications.',
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $pub_table,
+        'chado_column' => $pkey,
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'schema__publication_widget',
@@ -1409,6 +1360,8 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
   $rel_table = $table_name . '_relationship';
   if (chado_table_exists($rel_table)) {
     $field_name = 'sbo__relationship';
+    $schema = chado_get_schema($rel_table);
+    $pkey = $schema['primary key'][0];
     $info[$field_name] = array(
       'field_name' => $field_name,
       'entity_type' => $entity_type,
@@ -1418,6 +1371,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $rel_table,
+        'chado_column' => $pkey,
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'sbo__relationship_widget',
@@ -1439,6 +1395,8 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
   $syn_table = $table_name . '_synonym';
   if (chado_table_exists($syn_table)) {
     $field_name = 'schema__alternate_name';
+    $schema = chado_get_schema($syn_table);
+    $pkey = $schema['primary key'][0];
     $info[$field_name] = array(
       'field_name' => $field_name,
       'entity_type' => $entity_type,
@@ -1448,6 +1406,9 @@ function tripal_chado_bundle_create_instances_linker(&$info, $entity_type, $bund
       'required' => FALSE,
       'settings' => array(
         'auto_attach' => FALSE,
+        'chado_table' => $syn_table,
+        'chado_column' => $pkey,
+        'base_table' => $table_name,
       ),
       'widget' => array(
         'type' => 'schema__alternate_name_widget',
@@ -1628,3 +1589,76 @@ function tripal_chado_form_field_ui_field_overview_add_new($new_field, $bundle)
     }
   }
 }
+
+
+/**
+ * Allows for altering of a field's instance setting form.
+ *
+ * This appears to be a Drupal hook but is actually a custom function created
+ * by this module. It is called by the tripal_form_alter() function of this
+ * module.
+ *
+ * Here we put additional form elements for any field, regardless if it is
+ * a tripalField or not.
+ *
+ * @param $form
+ *   The form array.  Alterations to the form can be made within this array.
+ * @param $form_state
+ *   The form state array.
+ */
+function tripal_chado_field_instance_settings_form_alter(&$form, $form_state) {
+  global $language;
+  $field = $form['#field'];
+  $instance = $form['#instance'];
+
+  // Construct a table for the vocabulary information.
+  $headers = array();
+  $rows = array();
+  $rows[] = array(
+    array(
+      'data' => 'Base Table',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $instance['settings']['base_table']
+  );
+  $rows[] = array(
+    array(
+      'data' => 'Record Table',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $instance['settings']['chado_table']
+  );
+  $rows[] = array(
+    array(
+      'data' => 'ID Column',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $instance['settings']['chado_column']
+  );
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+
+  $form['chado_mapping'] = array(
+    '#type' => 'fieldset',
+    '#title' => 'Chado Mapping',
+    '#description' => t('This field maps to data in Chado to the following table:'),
+    '#prefix' => '<div id = "tripal-field-term-fieldset">',
+    '#suffix' => '</div>',
+  );
+  $form['chado_mapping']['details'] = array(
+    '#type' => 'item',
+    '#markup' => theme_table($table),
+  );
+
+}

+ 13 - 0
tripal_chado/tripal_chado.module

@@ -801,3 +801,16 @@ function tripal_chado_form_field_ui_field_edit_form_alter(&$form, &$form_state,
 
   // TODO: don't the the maximum length be larger than the field size.
 }
+
+/**
+ * Implements hook_form_alter().
+ */
+function tripal_chado_form_alter(&$form, $form_state, $form_id) {
+  // If this is the field_ui_field_edit_form (i.e. the form that appears
+  // when editing a field that is attached to an entity). Then we want
+  // to add term settings for any field attached to a TripalEntity
+  // content type.
+  if ($form_id == 'field_ui_field_edit_form' and $form['#instance']['entity_type'] == 'TripalEntity') {
+    tripal_chado_field_instance_settings_form_alter($form, $form_state);
+  }
+}