Browse Source

Adjusted the fields so that the term they are associated with is now in the instance settings. This will allow site admins to change the term, but also allow for flexibility when adding new cvterm and prop fields to an entity

Stephen Ficklin 8 years ago
parent
commit
97be1bbb0b
99 changed files with 851 additions and 996 deletions
  1. 9 5
      tripal/api/tripal.terms.api.inc
  2. 28 41
      tripal/includes/TripalFields/TripalField.inc
  3. 4 4
      tripal/includes/TripalFields/TripalFieldFormatter.inc
  4. 2 2
      tripal/includes/TripalFields/TripalFieldWidget.inc
  5. 17 21
      tripal/includes/TripalFields/rdfs__type/rdfs__type.inc
  6. 2 2
      tripal/includes/TripalFields/rdfs__type/rdfs__type_formatter.inc
  7. 1 1
      tripal/includes/TripalFields/rdfs__type/rdfs__type_widget.inc
  8. 181 19
      tripal/includes/tripal.fields.inc
  9. 7 6
      tripal/tripal.module
  10. 0 1
      tripal_chado/includes/TripalFields.old/chado_base__dbxref_id.inc
  11. 0 1
      tripal_chado/includes/TripalFields.old/chado_base__organism_id.inc
  12. 0 1
      tripal_chado/includes/TripalFields.old/chado_feature__md5checksum.inc
  13. 0 1
      tripal_chado/includes/TripalFields.old/chado_feature__residues.inc
  14. 0 1
      tripal_chado/includes/TripalFields.old/chado_feature__seqlen.inc
  15. 0 1
      tripal_chado/includes/TripalFields.old/chado_gene__transcripts.inc
  16. 1 2
      tripal_chado/includes/TripalFields.old/chado_linker__contact.inc
  17. 0 1
      tripal_chado/includes/TripalFields.old/chado_linker__cvterm.inc
  18. 5 6
      tripal_chado/includes/TripalFields.old/chado_linker__cvterm_adder.inc
  19. 0 1
      tripal_chado/includes/TripalFields.old/chado_linker__dbxref.inc
  20. 0 1
      tripal_chado/includes/TripalFields.old/chado_linker__expression.inc
  21. 1 2
      tripal_chado/includes/TripalFields.old/chado_linker__featureloc.inc
  22. 2 3
      tripal_chado/includes/TripalFields.old/chado_linker__featurepos.inc
  23. 2 3
      tripal_chado/includes/TripalFields.old/chado_linker__genotype.inc
  24. 2 3
      tripal_chado/includes/TripalFields.old/chado_linker__phenotype.inc
  25. 0 1
      tripal_chado/includes/TripalFields.old/chado_linker__prop.inc
  26. 0 1
      tripal_chado/includes/TripalFields.old/chado_linker__prop_adder.inc
  27. 0 1
      tripal_chado/includes/TripalFields.old/chado_linker__pub.inc
  28. 2 1
      tripal_chado/includes/TripalFields.old/chado_linker__relationship.inc
  29. 0 1
      tripal_chado/includes/TripalFields.old/chado_linker__synonym.inc
  30. 0 1
      tripal_chado/includes/TripalFields.old/chado_organism__type_id.inc
  31. 23 49
      tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact.inc
  32. 7 7
      tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact_formatter.inc
  33. 1 1
      tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact_widget.inc
  34. 22 47
      tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm.inc
  35. 7 7
      tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm_formatter.inc
  36. 1 1
      tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm_widget.inc
  37. 17 40
      tripal_chado/includes/TripalFields/chado_linker__cvterm_adder/chado_linker__cvterm_adder.inc
  38. 2 2
      tripal_chado/includes/TripalFields/chado_linker__cvterm_adder/chado_linker__cvterm_adder_formatter.inc
  39. 1 1
      tripal_chado/includes/TripalFields/chado_linker__cvterm_adder/chado_linker__cvterm_adder_widget.inc
  40. 21 47
      tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop.inc
  41. 2 2
      tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop_formatter.inc
  42. 1 1
      tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop_widget.inc
  43. 17 42
      tripal_chado/includes/TripalFields/chado_linker__prop_adder/chado_linker__prop_adder.inc
  44. 2 2
      tripal_chado/includes/TripalFields/chado_linker__prop_adder/chado_linker__prop_adder_formatter.inc
  45. 16 17
      tripal_chado/includes/TripalFields/chado_linker__prop_adder/chado_linker__prop_adder_widget.inc
  46. 17 10
      tripal_chado/includes/TripalFields/data__accession/data__accession.inc
  47. 2 2
      tripal_chado/includes/TripalFields/data__accession/data__accession_formatter.inc
  48. 1 1
      tripal_chado/includes/TripalFields/data__accession/data__accession_widget.inc
  49. 18 11
      tripal_chado/includes/TripalFields/data__protein_sequence/data__protein_sequence.inc
  50. 2 2
      tripal_chado/includes/TripalFields/data__protein_sequence/data__protein_sequence_formatter.inc
  51. 1 1
      tripal_chado/includes/TripalFields/data__protein_sequence/data__protein_sequence_widget.inc
  52. 18 11
      tripal_chado/includes/TripalFields/data__sequence/data__sequence.inc
  53. 2 2
      tripal_chado/includes/TripalFields/data__sequence/data__sequence_formatter.inc
  54. 1 1
      tripal_chado/includes/TripalFields/data__sequence/data__sequence_widget.inc
  55. 18 11
      tripal_chado/includes/TripalFields/data__sequence_checksum/data__sequence_checksum.inc
  56. 2 2
      tripal_chado/includes/TripalFields/data__sequence_checksum/data__sequence_checksum_formatter.inc
  57. 1 1
      tripal_chado/includes/TripalFields/data__sequence_checksum/data__sequence_checksum_widget.inc
  58. 18 45
      tripal_chado/includes/TripalFields/data__sequence_coordinates/data__sequence_coordinates.inc
  59. 2 2
      tripal_chado/includes/TripalFields/data__sequence_coordinates/data__sequence_coordinates_formatter.inc
  60. 1 1
      tripal_chado/includes/TripalFields/data__sequence_coordinates/data__sequence_coordinates_widget.inc
  61. 18 10
      tripal_chado/includes/TripalFields/data__sequence_length/data__sequence_length.inc
  62. 4 4
      tripal_chado/includes/TripalFields/data__sequence_length/data__sequence_length_formatter.inc
  63. 1 1
      tripal_chado/includes/TripalFields/data__sequence_length/data__sequence_length_widget.inc
  64. 23 49
      tripal_chado/includes/TripalFields/go__gene_expression/go__gene_expression.inc
  65. 5 5
      tripal_chado/includes/TripalFields/go__gene_expression/go__gene_expression_formatter.inc
  66. 1 1
      tripal_chado/includes/TripalFields/go__gene_expression/go__gene_expression_widget.inc
  67. 18 11
      tripal_chado/includes/TripalFields/obi__organism/obi__organism.inc
  68. 2 2
      tripal_chado/includes/TripalFields/obi__organism/obi__organism_formatter.inc
  69. 1 1
      tripal_chado/includes/TripalFields/obi__organism/obi__organism_widget.inc
  70. 18 44
      tripal_chado/includes/TripalFields/ogi__location_on_map/ogi__location_on_map.inc
  71. 2 2
      tripal_chado/includes/TripalFields/ogi__location_on_map/ogi__location_on_map_formatter.inc
  72. 1 1
      tripal_chado/includes/TripalFields/ogi__location_on_map/ogi__location_on_map_widget.inc
  73. 22 48
      tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference.inc
  74. 3 3
      tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference_formatter.inc
  75. 1 1
      tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference_widget.inc
  76. 25 51
      tripal_chado/includes/TripalFields/sbo__phenotype/sbo__phenotype.inc
  77. 7 7
      tripal_chado/includes/TripalFields/sbo__phenotype/sbo__phenotype_formatter.inc
  78. 1 1
      tripal_chado/includes/TripalFields/sbo__phenotype/sbo__phenotype_widget.inc
  79. 18 26
      tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship.inc
  80. 11 11
      tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship_formatter.inc
  81. 1 1
      tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship_widget.inc
  82. 23 48
      tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name.inc
  83. 2 2
      tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name_formatter.inc
  84. 1 1
      tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name_widget.inc
  85. 25 50
      tripal_chado/includes/TripalFields/schema__publication/schema__publication.inc
  86. 2 2
      tripal_chado/includes/TripalFields/schema__publication/schema__publication_formatter.inc
  87. 1 1
      tripal_chado/includes/TripalFields/schema__publication/schema__publication_widget.inc
  88. 18 11
      tripal_chado/includes/TripalFields/so__cds/so__cds.inc
  89. 2 2
      tripal_chado/includes/TripalFields/so__cds/so__cds_formatter.inc
  90. 1 1
      tripal_chado/includes/TripalFields/so__cds/so__cds_widget.inc
  91. 23 48
      tripal_chado/includes/TripalFields/so__genotype/so__genotype.inc
  92. 7 7
      tripal_chado/includes/TripalFields/so__genotype/so__genotype_formatter.inc
  93. 1 1
      tripal_chado/includes/TripalFields/so__genotype/so__genotype_widget.inc
  94. 18 11
      tripal_chado/includes/TripalFields/so__transcript/so__transcript.inc
  95. 7 7
      tripal_chado/includes/TripalFields/so__transcript/so__transcript_formatter.inc
  96. 1 1
      tripal_chado/includes/TripalFields/so__transcript/so__transcript_widget.inc
  97. 21 14
      tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon.inc
  98. 4 4
      tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon_formatter.inc
  99. 1 1
      tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon_widget.inc

+ 9 - 5
tripal/api/tripal.terms.api.inc

@@ -191,11 +191,15 @@ function tripal_add_term($details) {
  *
  * @return
  *   An array with at least the following keys:
- *     vocabulary : The short name of the vocabulary (e.g. SO, PATO, foaf).
- *     accession : The name unique ID of the term.
- *     url : The URL for the term.
- *     name : The name of the term.
- *     definition : The term's description.
+ *     - vocabulary : An array containing the following keys:
+ *       - name : The full name of the vocabulary.
+ *       - short_name : The short name abbreviation for the vocabulary.
+ *       - description : A brief description of the vocabulary.
+ *       - url : (optional) A URL for the online resources for the vocabulary.
+ *     - accession : The name unique ID of the term.
+ *     - url : The URL for the term.
+ *     - name : The name of the term.
+ *     - definition : The term's description.
  *   any other keys may be added as desired. Returns NULL if the term
  *   cannot be found.
  */

+ 28 - 41
tripal/includes/TripalField.inc → tripal/includes/TripalFields/TripalField.inc

@@ -11,30 +11,40 @@ class TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'schema:Thing';
-
   // The default lable for this field.
-  public static $label = 'Tripal Field';
+  public static $default_label = 'Tripal Field';
 
   // The default description for this field.
-  public static $description = 'The generic base class for all Tripal fields. ' .
+  public static $default_description = 'The generic base class for all Tripal fields. ' .
     'Replace this text as appropriate for the child implementation.';
 
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array();
+  // Once instances exist for a field type then these settings cannot be
+  // changed.
+  public static $default_settings = array(
+  );
 
   // Provide a list of instance specific settings. These can be access within
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'schema',
+    // The name of the term.
+    'term_name' => 'Thing',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'Thing',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
@@ -77,8 +87,10 @@ class TripalField {
     $this->instance = $instance;
 
     $class = get_called_class();
+
     // Make sure the term exist.
-    list($vocabulary, $accession) = preg_split('/:/', $class::$term);
+    $vocabulary = $instance->settings['term_vocabulary'];
+    $accession = $instance->settings['term_accession'];
     $term = tripal_get_term_details($vocabulary, $accession);
     if (!$term) {
       //throw new Error(t('Cannot create TripalField of type "%term" as that
@@ -104,12 +116,12 @@ class TripalField {
   public static function info() {
     $class = get_called_class();
     return array(
-      'label' => $class::$label,
-      'description' => $class::$description,
+      'label' => $class::$default_label,
+      'description' => $class::$default_description,
       'default_widget' => $class::$default_widget,
       'default_formatter' => $class::$default_formatter,
-      'settings' => $class::$settings,
-      'instance_settings' => $class::$instance_settings,
+      'settings' => $class::$default_settings,
+      'instance_settings' => $class::$default_instance_settings,
       'storage' => array(
         'type' => $class::$storage,
         'module' => 'tripal',
@@ -226,18 +238,6 @@ class TripalField {
     $settings = $this->field['settings'];
     $element = array();
 
-//     $element['semantic_web'] = array(
-//       '#type' => 'textfield',
-//       '#title' => 'Semantic Web',
-//       '#description' => t('Each field must be associated with a term
-//           from a controlled vocabulary.  This allows computer programs to understand
-//           the data provided on this site.  Please be cautions changing these
-//           values.  Defaults are set by Tripal and sites that use the same
-//           terms can exchange information.'),
-//       '#collapsed' => TRUE,
-//       '#collapsible' => TRUE,
-//       '#tree' => TRUE,
-//     );
     $element['#field'] = $this->field;
     $element['#instance'] = $this->instance;
     $element['#element_validate'][] = 'tripal_field_settings_form_validate';
@@ -292,22 +292,9 @@ class TripalField {
     $settings = $this->instance['settings'];
     $element = array();
 
-    //     $element['semantic_web'] = array(
-    //       '#type' => 'textfield',
-    //       '#title' => 'Semantic Web',
-    //       '#description' => t('Each field must be associated with a term
-    //           from a controlled vocabulary.  This allows computer programs to understand
-    //           the data provided on this site.  Please be cautions changing these
-    //           values.  Defaults are set by Tripal and sites that use the same
-    //           terms can exchange information.'),
-    //       '#collapsed' => TRUE,
-    //       '#collapsible' => TRUE,
-    //       '#tree' => TRUE,
-    //     );
     $element['#field'] = $this->field;
     $element['#instance'] = $this->instance;
     $element['#element_validate'][] = 'tripal_field_instance_settings_form_validate';
-
     return $element;
   }
   /**

+ 4 - 4
tripal/includes/TripalFieldFormatter.inc → tripal/includes/TripalFields/TripalFieldFormatter.inc

@@ -2,13 +2,13 @@
 
 class TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Tripal Field.';
+  public static $default_label = 'Tripal Field.';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array();
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
 
   /**
    * Instantiates a new TripalFieldFormatter object.
@@ -43,9 +43,9 @@ class TripalFieldFormatter {
   public static function info() {
     $class = get_called_class();
     return array(
-      'label' => $class::$label,
+      'label' => $class::$default_label,
       'field types' => $class::$field_types,
-      'settings' => $class::$settings,
+      'settings' => $class::$default_settings,
     );
   }
 

+ 2 - 2
tripal/includes/TripalFieldWidget.inc → tripal/includes/TripalFields/TripalFieldWidget.inc

@@ -2,7 +2,7 @@
 
 class TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Tripal Field.';
+  public static $default_label = 'Tripal Field.';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('no_widget');
@@ -40,7 +40,7 @@ class TripalFieldWidget {
   public static function info() {
     $class = get_called_class();
     return array(
-      'label' => $class::$label,
+      'label' => $class::$default_label,
       'field types' => $class::$field_types,
     );
   }

+ 17 - 21
tripal/includes/TripalFields/rdfs__type/rdfs__type.inc

@@ -2,14 +2,8 @@
 
 class rdfs__type extends TripalField {
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'rdfs:type';
-
   // The default lable for this field.
-  public static $label = 'Content Type';
+  public static $default_label = 'Content Type';
 
   // The default description for this field.
   public static $description = 'The resource content type.';
@@ -17,13 +11,27 @@ class rdfs__type extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array();
+  public static $default_settings = array();
 
   // Provide a list of instance specific settings. These can be access within
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'rdfs',
+    // The name of the term.
+    'term_name' => 'type',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'type',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
@@ -51,18 +59,6 @@ class rdfs__type extends TripalField {
     $settings = $this->field['settings'];
     $element = array();
 
-//     $element['semantic_web'] = array(
-//       '#type' => 'textfield',
-//       '#title' => 'Semantic Web',
-//       '#description' => t('Each field must be associated with a term
-//           from a controlled vocabulary.  This allows computer programs to understand
-//           the data provided on this site.  Please be cautions changing these
-//           values.  Defaults are set by Tripal and sites that use the same
-//           terms can exchange information.'),
-//       '#collapsed' => TRUE,
-//       '#collapsible' => TRUE,
-//       '#tree' => TRUE,
-//     );
     $element['#field'] = $this->field;
     $element['#instance'] = $this->instance;
     $element['#element_validate'][] = 'tripal_field_settings_form_validate';

+ 2 - 2
tripal/includes/TripalFields/rdfs__type/rdfs__type_formatter.inc

@@ -2,13 +2,13 @@
 
 class rdfs__type_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Content Type';
+  public static $default_label = 'Content Type';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('rdfs__type');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
 
   /**
    * @see TripalFieldFormatter::view()

+ 1 - 1
tripal/includes/TripalFields/rdfs__type/rdfs__type_widget.inc

@@ -2,7 +2,7 @@
 
 class rdfs__type_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Content Type';
+  public static $default_label = 'Content Type';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('rdfs__type');

+ 181 - 19
tripal/includes/tripal.fields.inc

@@ -64,7 +64,6 @@ function tripal_field_formatter_info() {
   foreach ($formatters as $formatter) {
     $info[$formatter] = $formatter::info();
   }
-  dpm($info);
   return $info;
 }
 
@@ -170,7 +169,6 @@ function tripal_field_no_delete() {
  * the table to let the user know where fields are storing their data.
  */
 function tripal_form_field_ui_field_overview_form_alter(&$form, &$form_state, $form_id) {
-  //dpm($form);
 
   // Add the 'Storage Location' to the table header.
   $form['fields']['#header'][] = 'Term';
@@ -189,6 +187,7 @@ function tripal_form_field_ui_field_overview_form_alter(&$form, &$form_state, $f
 
 
     $field = field_info_field($field_name);
+    $instance = field_info_instance('TripalEntity', $field_name, $form['#bundle']);
     // For rows in the tables that aren't fields, just add an empty value
     // for the storage column.
     if (!$field) {
@@ -200,7 +199,10 @@ function tripal_form_field_ui_field_overview_form_alter(&$form, &$form_state, $f
       );
       continue;
     }
-    $term = $field['settings']['tripal_term'] ? $field['settings']['tripal_term'] : 'N/A';
+    $term = '';
+    if (array_key_exists('term_accession', $instance['settings']) and $instance['settings']['term_accession']) {
+      $term = $instance['settings']['term_vocabulary'] . ':' . $instance['settings']['term_accession'];
+    }
     $form['fields'][$field_name][] = array(
       '#markup' => $term,
     );
@@ -268,27 +270,175 @@ function tripal_field_settings_form($field, $instance, $has_data) {
  * 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_field_instance_settings_form_alter(&$form, $form_state) {
+  global $language;
+
+  // It's not possible to add AJAX to a form element in the hook_form_alter
+  // function.  To make it work we have to add a process function. Inisde
+  // of that process function is where the form additions get added that use
+  // Ajax.
+  $form['field_term'][$language->language][0]['#process'] = array('tripal_field_instance_settings_form_process');
+  $form['#submit'][] = 'tripal_field_instance_settings_form_submit';
+}
+
+/**
+ * Implements a process function for the instnace settings form.
+ *
+ * See the comment in the tripal_field_instance_settings_form_alter() for
+ * more details.
+ */
+function tripal_field_instance_settings_form_process($element, &$form_state, $form) {
   $field = $form['#field'];
   $instance = $form['#instance'];
 
-  $form['tripal_additions'] = array(
+  // Get the term for this instance.
+  $vocabulary = $instance['settings']['term_vocabulary'];
+  $accession = $instance['settings']['term_accession'];
+  $term_name = $instance['settings']['term_name'];
+  $is_fixed = $instance['settings']['term_fixed'];
+  $term = tripal_get_term_details($vocabulary, $accession);
+
+  // Construct a table for the vocabulary information.
+  $headers = array();
+  $rows = array();
+  $rows[] = array(
+    array(
+      'data' => 'Vocabulary',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $term['vocabulary']['name'] . ' (' . $term['vocabulary']['short_name'] . ') ' . $term['vocabulary']['description']
+  );
+  $rows[] = array(
+    array(
+      'data' => 'Term',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $term['name'] . ':' . $term['accession']
+  );
+  $rows[] = array(
+    array(
+      'data' => 'Definition',
+      'header' => TRUE,
+      'width' => '20%',
+    ),
+    $term['definition']
+  );
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+
+  $element['field_term'] = array(
     '#type' => 'fieldset',
-    '#title' => 'Tripal Settings',
+    '#title' => 'Controlled Vocabulary Term',
+    '#description' => t('All fields attached to a Tripal-based content type must
+        be associated with a controlled vocabulary term.  Please use caution
+        when changing the term for this field as other sites may expect this term
+        when querying web services.'),
+    '#prefix' => '<div id = "tripal-field-term-fieldset">',
+    '#suffix' => '</div>',
   );
-  $form['tripal_additions']['semantic_web'] = array(
-    '#type' => 'textfield',
-    '#title' => 'Vocabulary Term'
+  $element['field_term']['term_vocabulary'] = array(
+    '#type' => 'value',
+    '#value' => $vocabulary,
+  );
+  $element['field_term']['term_name'] = array(
+    '#type' => 'value',
+    '#value' => $term_name,
   );
-  $form['tripal_additions']['storage'] = array(
+  $element['field_term']['term_accession'] = array(
+    '#type' => 'value',
+    '#value' => $accession,
+  );
+  $element['field_term']['details'] = array(
+    '#type' => 'item',
+    '#title' => 'Current Term',
+    '#markup' => theme_table($table),
+  );
+  $element['field_term']['new_name'] = array(
     '#type' => 'textfield',
-    '#title' => 'Storage Backend'
+    '#title' => 'Change the term',
+    // TODO: This autocomplete path should not use Chado.
+    '#autocomplete_path' => "admin/tripal/storage/chado/auto_name/cvterm/",
+  );
+  $element['field_term']['select_button'] = array(
+    '#type' => 'button',
+    '#value' => t('Lookup Term'),
+    '#name' => 'select_cvterm',
+    '#ajax' => array(
+      'callback' => "tripal_fields_select_term_form_ajax_callback",
+      'wrapper' => "tripal-field-term-fieldset",
+      'effect' => 'fade',
+      'method' => 'replace'
+    ),
   );
+  $term_name = array_key_exists('values', $form_state) ? $form_state['values']['new_name'] : '';
+  if ($term_name) {
+    $element['field_term']['instructions'] = array(
+      '#type' => 'item',
+      '#title' => 'Matching terms',
+      '#markup' => t('Please select the term the best matches the
+        content type you want to associate with this field. If the same term exists in
+        multiple vocabularies you will see more than one option below.')
+    );
+    $match = array(
+      'name' => $term_name,
+    );
+    $terms = chado_generate_var('cvterm', $match, array('return_array' => TRUE));
+    $terms = chado_expand_var($terms, 'field', 'cvterm.definition');
+    $num_terms = 0;
+    foreach ($terms as $term) {
+      // Save the user a click by setting the default value as 1 if there's
+      // only one matching term.
+      $default = FALSE;
+      $attrs = array();
+      if ($num_terms == 0 and count($terms) == 1) {
+        $default = TRUE;
+        $attrs = array('checked' => 'checked');
+      }
+      $element['field_term']['term-' . $term->cvterm_id] = array(
+        '#type' => 'checkbox',
+        '#title' =>  $term->name,
+        '#default_value' => $default,
+        '#attributes' => $attrs,
+        '#description' => '<b>Vocabulary:</b> ' . $term->cv_id->name . ' (' . $term->dbxref_id->db_id->name . ') ' . $term->cv_id->definition .
+        '<br><b>Term: </b> ' . $term->dbxref_id->db_id->name . ':' . $term->dbxref_id->accession . '.  ' .
+        '<br><b>Definition:</b>  ' . $term->definition,
+      );
+      $num_terms++;
+    }
+    if ($num_terms == 0) {
+      $element['field_term']['none'] = array(
+        '#type' => 'item',
+        '#markup' => '<i>' . t('There is no term that matches the entered text.') . '</i>'
+      );
+    }
+  }
+  $element['#element_validate'][] = 'tripal_field_instance_settings_form_validate';
+  return $element;
+}
+
+/**
+ * Implements an AJAX callback for the tripal_field_vocab_select_term_form.
+ */
+function tripal_fields_select_term_form_ajax_callback($form, $form_state) {
+  return $form['field_term'];
 }
 /**
  * Implements hook_instance_settings_form()
@@ -304,17 +454,29 @@ function tripal_field_instance_settings_form($field, $instance) {
 //   return $form;
 }
 /**
- *
+ * Validate our custom instance settings form fields.
  */
 function tripal_field_instance_settings_form_validate($form, &$form_state) {
-//   $field = $form['#field'];
-//   $instance = $form['#instance'];
-//   $field_type = $field['type'];
-//   tripal_load_include_field_class($field_type);
-//   if (class_exists($field_type)) {
-//     $tfield = new $field_type($field, $instance);
-//     $form = $tfield->instanceSettingsFormValidate($form, $form_state);
-//   }
+  // If the user clicked the submit button then we want set the
+  // instance settings values accordingly.
+  foreach ($form_state['input'] as $key => $value) {
+    $matches = array();
+    if (preg_match("/^term-(\d+)$/", $key, $matches) and
+        $form_state['input']['term-' . $matches[1]]) {
+      $cvterm_id = $matches[1];
+      // TODO: this should not call a Chado function.
+      $term = chado_generate_var('cvterm', array('cvterm_id' => $cvterm_id));
+      $form_state['values']['instance']['settings']['term_vocabulary'] = $term->dbxref_id->db_id->name;
+      $form_state['values']['instance']['settings']['term_accession'] = $term->dbxref_id->accession;
+      $form_state['values']['instance']['settings']['term_name'] = $term->name;
+    }
+  }
+}
+/**
+ * Custom submit function for instance settings form.
+ */
+function tripal_field_instance_settings_form_submit($form, &$form_state) {
+
 }
 
 /**

+ 7 - 6
tripal/tripal.module

@@ -24,9 +24,9 @@ require_once "includes/TripalEntityViewsController.inc";
 require_once "includes/TripalBundle.inc";
 require_once "includes/TripalBundleController.inc";
 require_once "includes/TripalBundleUIController.inc";
-require_once "includes/TripalField.inc";
-require_once "includes/TripalFieldWidget.inc";
-require_once "includes/TripalFieldFormatter.inc";
+require_once "includes/TripalFields/TripalField.inc";
+require_once "includes/TripalFields/TripalFieldWidget.inc";
+require_once "includes/TripalFields/TripalFieldFormatter.inc";
 require_once "includes/TripalFieldQuery.inc";
 
 /**
@@ -569,10 +569,11 @@ function tripal_import_api() {
  * Implements hook_form_alter().
  */
 function tripal_form_alter(&$form, $form_state, $form_id) {
-  // If this i the field_ui_field_edit_form (i.e. the form that appears
+  // 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 semantic web settings.
-  if ($form_id == 'field_ui_field_edit_form') {
+  // 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_field_instance_settings_form_alter($form, $form_state);
   }
 }

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_base__dbxref_id.inc

@@ -16,7 +16,6 @@ class chado_base__dbxref_id extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_base__organism_id.inc

@@ -16,7 +16,6 @@ class chado_base__organism_id extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_feature__md5checksum.inc

@@ -15,7 +15,6 @@ class chado_feature__md5checksum  extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
 

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_feature__residues.inc

@@ -16,7 +16,6 @@ class chado_feature__residues extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
 

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_feature__seqlen.inc

@@ -15,7 +15,6 @@ class chado_feature__seqlen extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_gene__transcripts.inc

@@ -15,7 +15,6 @@ class chado_gene__transcripts extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

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

@@ -17,7 +17,6 @@ class chado_linker__contact extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support
@@ -99,7 +98,7 @@ class chado_linker__contact extends TripalField {
     $fkey_value = $element['#entity']->chado_record_id;
     $contact_id = '';
     $name = '';
-    
+
     // If the field already has a value then it will come through the $items
     // array.  This happens when editing an existing record.
     if (count($items) > 0 and array_key_exists($delta, $items)) {

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_linker__cvterm.inc

@@ -16,7 +16,6 @@ class chado_linker__cvterm extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 5 - 6
tripal_chado/includes/TripalFields.old/chado_linker__cvterm_adder.inc

@@ -16,7 +16,6 @@ class chado_linker__cvterm_adder extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support
@@ -86,18 +85,18 @@ class chado_linker__cvterm_adder extends TripalField {
    * @see TripalField::widgetFormValidate()
    */
   public function widgetFormValidate($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
-  
+
     if (array_key_exists('triggering_element', $form_state) and
         $form_state['triggering_element']['#name'] == 'cvterm_class_adder_button') {
           $this_field = $this->field;
           $field_name = $this_field['field_name'];
           $bundle = $entity->bundle;
-          
+
           // Get the base table name from the field annotations.
           $base_table = $entity->chado_table;
           $cvterm_class_adder = $form_state['values'][$base_table . '_cvterm'][$langcode][$delta]['value'];
           $cv = chado_generate_var('cv', array('cv_id' => $cvterm_class_adder));
-          
+
           // Make sure a valid vocabulary is selected
           if (!$cv) {
             form_set_error("$field_name][$langcode][$delta][value", "Please select a vocabulary.");
@@ -110,7 +109,7 @@ class chado_linker__cvterm_adder extends TripalField {
           }
         }
   }
-  
+
   /**
    * @see TripalField::widgetFormSubmit()
    */
@@ -124,7 +123,7 @@ class chado_linker__cvterm_adder extends TripalField {
           $this_field = $this->field;
           $field_name = $this_field['field_name'];
           $bundle = $entity->bundle;
-          
+
           // Get the base table name from the field annotations.
           $base_table = $entity->chado_table;
           $cvterm_class_adder = $form_state['values'][$base_table . '_cvterm'][$langcode][$delta]['value'];

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_linker__dbxref.inc

@@ -27,7 +27,6 @@ class chado_linker__dbxref extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_linker__expression.inc

@@ -16,7 +16,6 @@ class chado_linker__expression extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 1 - 2
tripal_chado/includes/TripalFields.old/chado_linker__featureloc.inc

@@ -16,7 +16,6 @@ class chado_linker__featureloc extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support
@@ -302,6 +301,6 @@ class chado_linker__featureloc extends TripalField {
   public static function widgetInfo() {
     return array();
   }
-  
+
 }
 

+ 2 - 3
tripal_chado/includes/TripalFields.old/chado_linker__featurepos.inc

@@ -16,7 +16,6 @@ class chado_linker__featurepos extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support
@@ -62,7 +61,7 @@ class chado_linker__featurepos extends TripalField {
       $position = $val['position'];
 
       $rows[] = array(
-        $map_name, 
+        $map_name,
         $mapped_feature_name,
         $position
       );
@@ -153,6 +152,6 @@ class chado_linker__featurepos extends TripalField {
   public static function widgetInfo() {
     return array();
   }
-  
+
 }
 

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

@@ -16,7 +16,6 @@ class chado_linker__genotype extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support
@@ -140,12 +139,12 @@ class chado_linker__genotype extends TripalField {
       }
     }
   }
-  
+
   /**
    * We don't want a widget so override this function.
    */
   public static function widgetInfo() {
     return array();
   }
-  
+
 }

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

@@ -16,7 +16,6 @@ class chado_linker__phenotype extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support
@@ -140,12 +139,12 @@ class chado_linker__phenotype extends TripalField {
       }
     }
   }
-  
+
   /**
    * We don't want a widget so override this function.
    */
   public static function widgetInfo() {
     return array();
   }
-  
+
 }

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_linker__prop.inc

@@ -15,7 +15,6 @@ class chado_linker__prop extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

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

@@ -16,7 +16,6 @@ class chado_linker__prop_adder extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_linker__pub.inc

@@ -17,7 +17,6 @@ class chado_linker__pub extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 2 - 1
tripal_chado/includes/TripalFields.old/chado_linker__relationship.inc

@@ -15,7 +15,6 @@ class chado_linker__relationship extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Provide a list of instance specific settings. These can be access within
@@ -1024,6 +1023,8 @@ return;
    */
   public function instanceSettingsFormValidate($form, &$form_state) {
 
+    $element = parent::instanceSettingsFormValidate();
+
     // Get relationships settings
     $settings = $form_state['values']['instance']['settings']['relationships'];
     $form_state['values']['instance']['settings']['relationships']['relationship_types']= trim($settings['relationship_types']);

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_linker__synonym.inc

@@ -16,7 +16,6 @@ class chado_linker__synonym extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 0 - 1
tripal_chado/includes/TripalFields.old/chado_organism__type_id.inc

@@ -16,7 +16,6 @@ class chado_organism__type_id extends TripalField {
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Set this to the name of the storage backend that by default will support

+ 23 - 49
tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact.inc

@@ -11,15 +11,8 @@ class chado_linker__contact extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'local:contact';
-
   // The default lable for this field.
-  public static $label = 'Contacts';
+  public static $default_label = 'Contacts';
 
   // The default description for this field.
   public static $description = 'Associates an indviddual or organization with
@@ -28,7 +21,7 @@ class chado_linker__contact extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -38,11 +31,25 @@ class chado_linker__contact extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'local',
+    // The name of the term.
+    'term_name' => 'contact',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'contact',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'chado_linker__contact_widget';
@@ -81,15 +88,15 @@ class chado_linker__contact extends TripalField {
     $field_type = $this->field['type'];
     $field_table = $this->field['settings']['chado_table'];
     $field_column = $this->field['settings']['chado_column'];
-    
+
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);
     $base_table = $details['record']->tablename;
     $pkey = $schema['primary key'][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(),
@@ -98,7 +105,7 @@ class chado_linker__contact extends TripalField {
       'chado-' . $field_table . '__' . 'contact_id' => '',
       // Ignore the synonym_sgml column for now.
     );
-    
+
     $linker_table = $base_table . '_contact';
     $options = array(
       'return_array' => 1,
@@ -145,46 +152,13 @@ class chado_linker__contact extends TripalField {
           'chado-' . $field_table . '__' . $fkey_lcolumn => $contact_linker->$fkey_lcolumn->$fkey_lcolumn,
           'chado-' . $field_table . '__' . 'contact_id' => $contact->contact_id
         );
-    
+
         if (property_exists($contact, 'entity_id')) {
           $entity->{$field_name}['und'][$i]['value']['entity'] = 'TripalEntity:' . $contact->entity_id;
         }
       }
     }
   }
-
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }
 
 /**

+ 7 - 7
tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact_formatter.inc

@@ -2,13 +2,13 @@
 
 class chado_linker__contact_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Contacts';
+  public static $default_label = 'Contacts';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__contact');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()
@@ -24,21 +24,21 @@ class chado_linker__contact_formatter extends TripalFieldFormatter {
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
     // Get the settings
     $settings = $display['settings'];
-    
+
     $headers = array('Name', 'Description', 'Type');
     $rows = array();
-    
+
     foreach ($items as $delta => $item) {
       $contact = $item['value'];
       if (!$contact) {
         continue;
       }
-    
+
       // Get the field values
       $contact_name = $contact['name'];
       $description = $contact['description'];
       $type = $contact['type'];
-    
+
       // Add a link i there is an entity.
       if (array_key_exists('entity', $item['value']) and $item['value']['entity']) {
         list($entity_type, $entity_id) = explode(':', $item['value']['entity']);
@@ -59,7 +59,7 @@ class chado_linker__contact_formatter extends TripalFieldFormatter {
       'empty' => 'No contacts available',
     );
     $content = theme_table($table);
-    
+
     if (count($items) > 0) {
       // once we have our table array structure defined, we call Drupal's theme_table()
       // function to generate the table.

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

@@ -2,7 +2,7 @@
 
 class chado_linker__contact_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Contacts';
+  public static $default_label = 'Contacts';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__contact');

+ 22 - 47
tripal_chado/includes/TripalFields/chado_linker__cvterm/chado_linker__cvterm.inc

@@ -11,15 +11,8 @@ class chado_linker__cvterm extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'local:cvterm';
-
   // The default lable for this field.
-  public static $label = 'Annotations';
+  public static $default_label = 'Annotations';
 
   // The default description for this field.
   public static $description = 'This record can be annotated with terms from other
@@ -28,7 +21,7 @@ class chado_linker__cvterm extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -38,11 +31,25 @@ class chado_linker__cvterm extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'local',
+    // The name of the term.
+    'term_name' => 'cvterm',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'cvterm',
+    // Set to TRUE if the site admin is allowed to change the term
+    // type. This will create form elements when editing the field instance
+    // to allow the site admin to change the term settings above.
+    'term_fixed' => FALSE,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'chado_linker__cvterm_widget';
@@ -81,18 +88,18 @@ class chado_linker__cvterm extends TripalField {
     $field_table = $this->field['settings']['chado_table'];
     $field_column = $this->field['settings']['chado_column'];
     $base_table = $this->field['settings']['base_table'];
-    
+
     $matches = array();
     preg_match('/(.*?)__(\d+)/', $field_name, $matches);
     $table_name = $matches[1];
     $cv_id = $matches[2];
-    
+
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);
     $pkey = $schema['primary key'][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.
     $chado_record = $entity->chado_record;
     $entity->{$field_name}['und'][0] = array(
@@ -115,7 +122,7 @@ class chado_linker__cvterm extends TripalField {
       'cv__cv_id' => '',
       'cvterm__name' => '',
     );
-    
+
     // Get the annotations associated with this base record for this fields type.
     $columns = array('*');
     $match = array(
@@ -146,38 +153,6 @@ class chado_linker__cvterm extends TripalField {
     }
   }
 
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }
 
 /**

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

@@ -2,13 +2,13 @@
 
 class chado_linker__cvterm_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Annotations';
+  public static $default_label = 'Annotations';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__cvterm');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()
@@ -16,19 +16,19 @@ class chado_linker__cvterm_formatter extends TripalFieldFormatter {
   public function settingsForm($view_mode, $form, &$form_state) {
     $headers = array('Term', 'Definition', 'Is Not', 'Reference');
     $rows = array();
-    
+
     $chado_table = $this->field['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']));
         $dbxref = $cvterm->dbxref_id;
-    
+
         // Build the accession.
         $accession = $dbxref->db_id->name . ':' . $dbxref->accession;
         if ($dbxref->db_id->urlprefix) {
           $accession = l($accession, tripal_get_dbxref_url($dbxref), array('attributes' => array('target' => '_blank')));
         }
-    
+
         // Build the publication reference.
         $pub_ref = '';
         $pub_id = $item['chado-' . $chado_table . '__pub_id'];
@@ -44,7 +44,7 @@ class chado_linker__cvterm_formatter extends TripalFieldFormatter {
         );
       }
     }
-    
+
     // the $table array contains the headers and rows array as well as other
     // options for controlling the display of the table.  Additional
     // documentation can be found here:
@@ -61,7 +61,7 @@ class chado_linker__cvterm_formatter extends TripalFieldFormatter {
       'colgroups' => array(),
       'empty' => 'There are no annotations of this type',
     );
-    
+
     if (count($items) > 0) {
       $element[0] = array(
         '#type' => 'markup',

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

@@ -2,7 +2,7 @@
 
 class chado_linker__cvterm_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Annotations';
+  public static $default_label = 'Annotations';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__cvterm');

+ 17 - 40
tripal_chado/includes/TripalFields/chado_linker__cvterm_adder/chado_linker__cvterm_adder.inc

@@ -11,15 +11,9 @@ class chado_linker__cvterm_adder extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'local:cvterm';
 
   // The default lable for this field.
-  public static $label = 'Add an Annotation Type';
+  public static $default_label = 'Add an Annotation Type';
 
   // The default description for this field.
   public static $description = 'This record may have any number of types of
@@ -28,7 +22,7 @@ class chado_linker__cvterm_adder extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -38,7 +32,21 @@ class chado_linker__cvterm_adder extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'local',
+    // The name of the term.
+    'term_name' => 'cvterm',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'cvterm',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
@@ -80,35 +88,4 @@ class chado_linker__cvterm_adder extends TripalField {
   }
 
 
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

+ 2 - 2
tripal_chado/includes/TripalFields/chado_linker__cvterm_adder/chado_linker__cvterm_adder_formatter.inc

@@ -2,13 +2,13 @@
 
 class chado_linker__cvterm_adder_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Add an Annotation Type';
+  public static $default_label = 'Add an Annotation Type';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__cvterm_adder');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()

+ 1 - 1
tripal_chado/includes/TripalFields/chado_linker__cvterm_adder/chado_linker__cvterm_adder_widget.inc

@@ -2,7 +2,7 @@
 
 class chado_linker__cvterm_adder_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Add an Annotation Type';
+  public static $default_label = 'Add an Annotation Type';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__cvterm_adder');

+ 21 - 47
tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop.inc

@@ -11,15 +11,8 @@ class chado_linker__prop extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'local:property';
-
   // The default lable for this field.
-  public static $label = 'Property';
+  public static $default_label = 'Property';
 
   // The default description for this field.
   public static $description = 'Add details about this property.';
@@ -27,7 +20,7 @@ class chado_linker__prop extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +30,25 @@ class chado_linker__prop extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'local',
+    // The name of the term.
+    'term_name' => 'property',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'property',
+    // Set to TRUE if the site admin is allowed to change the term
+    // type. This will create form elements when editing the field instance
+    // to allow the site admin to change the term settings above.
+    'term_fixed' => FALSE,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'chado_linker__prop_widget';
@@ -80,7 +87,7 @@ class chado_linker__prop extends TripalField {
     $field_table = $this->field['settings']['chado_table'];
     $field_column = $this->field['settings']['chado_column'];
     $base_table = $this->field['settings']['base_table'];
-    
+
     $matches = array();
     preg_match('/(.*?)__(\d+)/', $field_name, $matches);
     $table_name = $matches[1];
@@ -90,7 +97,7 @@ class chado_linker__prop extends TripalField {
     $pkey = $schema['primary key'][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.
     $chado_record = $entity->chado_record;
     $entity->{$field_name}['und'][0] = array(
@@ -101,7 +108,7 @@ class chado_linker__prop extends TripalField {
       'chado-' . $field_table . '__type_id' => '',
       'chado-' . $field_table . '__rank' => '',
     );
-    
+
     // Get the properties associated with this base record for this fields
     // given type.
     $columns = array('*');
@@ -128,37 +135,4 @@ class chado_linker__prop extends TripalField {
       }
     }
   }
-
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

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

@@ -2,13 +2,13 @@
 
 class chado_linker__prop_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Property';
+  public static $default_label = 'Property';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__prop');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()

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

@@ -2,7 +2,7 @@
 
 class chado_linker__prop_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Property';
+  public static $default_label = 'Property';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__prop');

+ 17 - 42
tripal_chado/includes/TripalFields/chado_linker__prop_adder/chado_linker__prop_adder.inc

@@ -11,15 +11,8 @@ class chado_linker__prop_adder extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'local:property';
-
   // The default lable for this field.
-  public static $label = 'Add a Property Type';
+  public static $default_label = 'Add a Property Type';
 
   // The default description for this field.
   public static $description = 'This record may have any number of properties. Use
@@ -28,7 +21,7 @@ class chado_linker__prop_adder extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -38,7 +31,21 @@ class chado_linker__prop_adder extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'local',
+    // The name of the term.
+    'term_name' => 'property',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'property',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
@@ -79,36 +86,4 @@ class chado_linker__prop_adder extends TripalField {
 
   }
 
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

+ 2 - 2
tripal_chado/includes/TripalFields/chado_linker__prop_adder/chado_linker__prop_adder_formatter.inc

@@ -2,13 +2,13 @@
 
 class chado_linker__prop_adder_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Add a Property Type';
+  public static $default_label = 'Add a Property Type';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__prop_adder');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()

+ 16 - 17
tripal_chado/includes/TripalFields/chado_linker__prop_adder/chado_linker__prop_adder_widget.inc

@@ -2,7 +2,7 @@
 
 class chado_linker__prop_adder_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Add a Property Type';
+  public static $default_label = 'Add a Property Type';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('chado_linker__prop_adder');
@@ -14,13 +14,13 @@ class chado_linker__prop_adder_widget extends TripalFieldWidget {
   public function form(&$widget, &$form, &$form_state, $langcode, $items, $delta, $element) {
     parent::form($widget, $form, $form_state, $langcode, $items, $delta, $element);
     $field_name = $widget['#field_name'];
-    
+
     $widget['#type'] = 'fieldset';
     $widget['#title'] = $element['#title'];
     $widget['#description'] = $element['#description'];
     $widget['#group'] = 'entity_form_vtabs';
-    
-    
+
+
     $widget['kvproperty_instructions'] = array(
       '#type' => 'item',
       '#markup' => t('You may add additional properties to this form by
@@ -32,9 +32,9 @@ class chado_linker__prop_adder_widget extends TripalFieldWidget {
           In the future, this field will be present for all records
           of this type.'),
     );
-    
+
     $term_name = isset($form_state['values'][$field_name]['und'][0]['wrapper']['term_name']) ? $form_state['values'][$field_name]['und'][0]['wrapper']['term_name'] : '';
-    
+
     // Drupal's vertical feild set is a bit quirky in that we can't just
     // add a prefix and suffix to the weidget.  If we do, then the
     // field doesn't show up on the page after an AJAX call.  We have to add
@@ -43,7 +43,7 @@ class chado_linker__prop_adder_widget extends TripalFieldWidget {
       '#prefix' =>  "<span id='$field_name-lookup-form'>",
       '#suffix' => '</span>',
     );
-    
+
     // If no term has been selected yet then provide the auto complete field.
     $widget['wrapper']['term_name'] = array(
       '#title'       => t('Term'),
@@ -56,7 +56,7 @@ class chado_linker__prop_adder_widget extends TripalFieldWidget {
       '#default_value' => $term_name,
       '#autocomplete_path' => "admin/tripal/storage/chado/auto_name/cvterm/",
     );
-    
+
     $widget['wrapper']['select_button'] = array(
       '#type' => 'button',
       '#value' => t('Lookup Term'),
@@ -139,7 +139,7 @@ class chado_linker__prop_adder_widget extends TripalFieldWidget {
   public function validate($form, &$form_state, $entity_type, $entity, $langcode, $delta) {
     $field = $this->field;
     $field_name = $field['field_name'];
-    
+
     if ($form_state['triggering_element']['#name'] == 'use_term_button') {
       // If the user has clicked the 'user_term_button' then we need to makes
       // sure that the cardinality textbox contains a positive integer.
@@ -147,7 +147,7 @@ class chado_linker__prop_adder_widget extends TripalFieldWidget {
       if (!preg_match('/^-*\d+$/', $cardinality) or $cardinality < -2 or $cardinality == 0) {
         form_set_error("$field_name][$langcode][$delta][wrapper][cardinality", "Please provide positive number for the number of values, or -1 for unlimited.");
       }
-    
+
       // Get selected terms
       $terms_list = $form_state['values'][$field_name][$langcode][$delta]['wrapper']['terms_list'];
       $counter = 0;
@@ -190,10 +190,10 @@ class chado_linker__prop_adder_widget extends TripalFieldWidget {
           // rather than have it fully submit.
           $form_state['rebuild'] = TRUE;
         }
-    
+
         // Get the table and base table.
         $base_table = $this->field['settings']['base_table'];
-    
+
         // Get the term for the property
         $field = $this->field;
         $fname = $field['field_name'];
@@ -207,17 +207,17 @@ class chado_linker__prop_adder_widget extends TripalFieldWidget {
           }
         }
         $cvterm = chado_generate_var('cvterm', array('cvterm_id' => $selected_term_id));
-    
+
         // Generate the name for the property table and the field name that we'll
         // be creating.
         $prop_table = $base_table . 'prop';
         $field_name = $prop_table . '__' . $cvterm->cvterm_id;
-    
+
         // The field name is the table name in this case. We want to get the
         // primary key as this should be the field that maps th the value.
         $schema = chado_get_schema($prop_table);
         $pkey = $schema['primary key'][0];
-    
+
         // Add the field if it doesn't already exists.
         $field = field_info_field($field_name);
         if (!$field) {
@@ -233,11 +233,10 @@ class chado_linker__prop_adder_widget extends TripalFieldWidget {
               'chado_table' => $prop_table,
               'chado_column' => $pkey,
               'base_table' => $base_table,
-              'semantic_web' => $cvterm->dbxref_id->db_id->name . ':' . $cvterm->dbxref_id->accession,
             ),
           ));
         }
-    
+
         // Create an instance of the field.
         $instance = field_info_instance($entity_type, $field_name,  $entity->bundle);
         if (!$instance) {

+ 17 - 10
tripal_chado/includes/TripalFields/data__accession/data__accession.inc

@@ -11,15 +11,8 @@ class data__accession extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'data:2091';
-
   // The default lable for this field.
-  public static $label = 'Accession';
+  public static $default_label = 'Accession';
 
   // The default description for this field.
   public static $description = 'The unique stable accession (ID) for
@@ -28,7 +21,7 @@ class data__accession extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -38,7 +31,21 @@ class data__accession extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'data',
+    // The name of the term.
+    'term_name' => 'accession',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '2091',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.

+ 2 - 2
tripal_chado/includes/TripalFields/data__accession/data__accession_formatter.inc

@@ -2,13 +2,13 @@
 
 class data__accession_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Accession';
+  public static $default_label = 'Accession';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__accession');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
 
   /**
    * @see TripalFieldFormatter::view()

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

@@ -1,7 +1,7 @@
 <?php
 class data__accession_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Accession';
+  public static $default_label = 'Accession';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__accession');

+ 18 - 11
tripal_chado/includes/TripalFields/data__protein_sequence/data__protein_sequence.inc

@@ -11,15 +11,8 @@ class data__protein_sequence extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'data:2976';
-
   // The default lable for this field.
-  public static $label = 'Protein Sequence';
+  public static $default_label = 'Protein Sequence';
 
   // The default description for this field.
   public static $description = 'polypeptide sequences.';
@@ -27,7 +20,7 @@ class data__protein_sequence extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +30,25 @@ class data__protein_sequence extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'data',
+    // The name of the term.
+    'term_name' => 'protein_sequence',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '2976',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'data__protein_sequence_widget';

+ 2 - 2
tripal_chado/includes/TripalFields/data__protein_sequence/data__protein_sequence_formatter.inc

@@ -2,13 +2,13 @@
 
 class data__protein_sequence_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Protein Sequence';
+  public static $default_label = 'Protein Sequence';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__protein_sequence');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
 
   /**
    *

+ 1 - 1
tripal_chado/includes/TripalFields/data__protein_sequence/data__protein_sequence_widget.inc

@@ -2,7 +2,7 @@
 
 class data__protein_sequence_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Protein Sequence';
+  public static $default_label = 'Protein Sequence';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__protein_sequence');

+ 18 - 11
tripal_chado/includes/TripalFields/data__sequence/data__sequence.inc

@@ -11,15 +11,8 @@ class data__sequence extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'data:2044';
-
   // The default lable for this field.
-  public static $label = 'Sequence';
+  public static $default_label = 'Sequence';
 
   // The default description for this field.
   public static $description = 'A field for managing nucleotide and protein residues.';
@@ -27,7 +20,7 @@ class data__sequence extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +30,25 @@ class data__sequence extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'data',
+    // The name of the term.
+    'term_name' => 'sequence',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '2044',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'data__sequence_widget';

+ 2 - 2
tripal_chado/includes/TripalFields/data__sequence/data__sequence_formatter.inc

@@ -2,13 +2,13 @@
 
 class data__sequence_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Sequence';
+  public static $default_label = 'Sequence';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__sequence');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
 
   /**
    *

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

@@ -2,7 +2,7 @@
 
 class data__sequence_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Sequence';
+  public static $default_label = 'Sequence';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__sequence');

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

@@ -11,15 +11,8 @@ class data__sequence_checksum extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'data:2190';
-
   // The default lable for this field.
-  public static $label = 'Sequence checksum';
+  public static $default_label = 'Sequence checksum';
 
   // The default description for this field.
   public static $description = 'A field for generating MD5 checksum for a sequence.';
@@ -27,7 +20,7 @@ class data__sequence_checksum extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +30,25 @@ class data__sequence_checksum extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'data',
+    // The name of the term.
+    'term_name' => 'sequence_checksum',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '2190',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'data__sequence_checksum_widget';

+ 2 - 2
tripal_chado/includes/TripalFields/data__sequence_checksum/data__sequence_checksum_formatter.inc

@@ -2,13 +2,13 @@
 
 class data__sequence_checksum_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Sequence checksum';
+  public static $default_label = 'Sequence checksum';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__sequence_checksum');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
 
 
  /**

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

@@ -2,7 +2,7 @@
 
 class data__sequence_checksum_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Sequence checksum';
+  public static $default_label = 'Sequence checksum';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__sequence_checksum');

+ 18 - 45
tripal_chado/includes/TripalFields/data__sequence_coordinates/data__sequence_coordinates.inc

@@ -11,16 +11,8 @@ class data__sequence_coordinates extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  // http://www.ebi.ac.uk/ols/ontologies/swo/terms?iri=http%3A%2F%2Fedamontology.org%2Fdata_2012
-  public static $term = 'data:2012';
-
   // The default lable for this field.
-  public static $label = 'Sequence Coordinates';
+  public static $default_label = 'Sequence Coordinates';
 
   // The default description for this field.
   public static $description = 'Locations on reference sequences where the feature is located.';
@@ -28,7 +20,7 @@ class data__sequence_coordinates extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -38,11 +30,25 @@ class data__sequence_coordinates extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'data',
+    // The name of the term.
+    'term_name' => 'sequence_coordinates',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '2012',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'data__sequence_coordinates_widget';
@@ -78,37 +84,4 @@ class data__sequence_coordinates extends TripalField {
   public function load($entity, $details = array()) {
 
   }
-
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

+ 2 - 2
tripal_chado/includes/TripalFields/data__sequence_coordinates/data__sequence_coordinates_formatter.inc

@@ -2,13 +2,13 @@
 
 class data__sequence_coordinates_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Sequence Coordinates';
+  public static $default_label = 'Sequence Coordinates';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__sequence_coordinates');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()

+ 1 - 1
tripal_chado/includes/TripalFields/data__sequence_coordinates/data__sequence_coordinates_widget.inc

@@ -2,7 +2,7 @@
 
 class data__sequence_coordinates_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Sequence Coordinates';
+  public static $default_label = 'Sequence Coordinates';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__sequence_coordinates');

+ 18 - 10
tripal_chado/includes/TripalFields/data__sequence_length/data__sequence_length.inc

@@ -11,15 +11,9 @@ class data__sequence_length extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'data:1249';
 
   // The default lable for this field.
-  public static $label = 'Sequence length';
+  public static $default_label = 'Sequence length';
 
   // The default description for this field.
   public static $description = 'A field for calculating the length of a sequence.';
@@ -27,7 +21,7 @@ class data__sequence_length extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +31,25 @@ class data__sequence_length extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'data',
+    // The name of the term.
+    'term_name' => 'sequence_length',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '1249',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'data__sequence_length_widget';

+ 4 - 4
tripal_chado/includes/TripalFields/data__sequence_length/data__sequence_length_formatter.inc

@@ -2,15 +2,15 @@
 
 class data__sequence_length_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Sequence length';
+  public static $default_label = 'Sequence length';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__sequence_length');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
-   * 
+   *
    * @see TripalFieldFormatter::settingsForm()
    */
   public function settingsForm($view_mode, $form, &$form_state) {
@@ -18,7 +18,7 @@ class data__sequence_length_formatter extends TripalFieldFormatter {
   }
 
   /**
-   * 
+   *
    * @see TripalFieldFormatter::view()
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {

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

@@ -2,7 +2,7 @@
 
 class data__sequence_length_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Sequence length';
+  public static $default_label = 'Sequence length';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('data__sequence_length');

+ 23 - 49
tripal_chado/includes/TripalFields/go__gene_expression/go__gene_expression.inc

@@ -11,28 +11,21 @@ class go__gene_expression extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'GO:0010467';
-
   // The default lable for this field.
-  public static $label = 'Gene expression';
+  public static $default_label = 'Gene expression';
 
   // The default description for this field.
-  public static $description = 'The process in which a gene\'s sequence is converted into a 
-      mature gene product or products (proteins or RNA). This includes the production of an 
-      RNA transcript as well as any processing to produce a mature RNA product or an 
-      mRNA (for protein-coding genes) and the translation of that mRNA into protein. 
-      Protein maturation is included when required to form an active form of a product from 
+  public static $description = 'The process in which a gene\'s sequence is converted into a
+      mature gene product or products (proteins or RNA). This includes the production of an
+      RNA transcript as well as any processing to produce a mature RNA product or an
+      mRNA (for protein-coding genes) and the translation of that mRNA into protein.
+      Protein maturation is included when required to form an active form of a product from
       an inactive precursor form.';
 
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -42,11 +35,25 @@ class go__gene_expression extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'GO',
+    // The name of the term.
+    'term_name' => 'gene expression',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '0010467',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'go__gene_expression_widget';
@@ -153,37 +160,4 @@ class go__gene_expression extends TripalField {
       }
     }
   }
-
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

+ 5 - 5
tripal_chado/includes/TripalFields/go__gene_expression/go__gene_expression_formatter.inc

@@ -2,13 +2,13 @@
 
 class go__gene_expression_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Gene expression';
+  public static $default_label = 'Gene expression';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('go__gene_expression');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()
@@ -24,7 +24,7 @@ class go__gene_expression_formatter extends TripalFieldFormatter {
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
     // Get the settings
     $settings = $display['settings'];
-    
+
     $content = '';
     $rows = array();
     foreach ($items as $delta => $item) {
@@ -33,9 +33,9 @@ class go__gene_expression_formatter extends TripalFieldFormatter {
       }
       // Iterate through all of the children of the $item['value']. Add each
       // one as an independent row in the table.
-    
+
       foreach ($item['value'] as $key => $value) {
-    
+
         // If this key is the name, then we want to link to the entity if one
         // exists.
         if ($key == 'name') {

+ 1 - 1
tripal_chado/includes/TripalFields/go__gene_expression/go__gene_expression_widget.inc

@@ -2,7 +2,7 @@
 
 class go__gene_expression_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Gene expression';
+  public static $default_label = 'Gene expression';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('go__gene_expression');

+ 18 - 11
tripal_chado/includes/TripalFields/obi__organism/obi__organism.inc

@@ -2,15 +2,8 @@
 
 class obi__organism extends TripalField {
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'OBI:organism';
-
   // The default lable for this field.
-  public static $label = 'Organism';
+  public static $default_label = 'Organism';
 
   // The default description for this field.
   public static $description = 'The organism to which this resource is sssociated.';
@@ -19,19 +12,33 @@ class obi__organism extends TripalField {
   // or the instanceSettingsForm() functions then you need to be sure that
   // any settings you want those functions to manage are listed in this
   // array.
-  public static $settings = array(
+  public static $default_settings = array(
     'field_display_string' => '<i>[organism.genus] [organism.species]</i>',
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
-    'semantic_web' => '',
   );
 
   // Provide a list of instance specific settings. These can be access within
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'OBI',
+    // The name of the term.
+    'term_name' => 'organism',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'organism',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
+
   // Set this to the name of the storage backend that by default will support
   // this field.
   public static $storage = 'field_chado_storage';

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

@@ -3,13 +3,13 @@
 class obi__organism_formatter extends TripalFieldFormatter {
 
   // The default lable for this field.
-  public static $label = 'Organism';
+  public static $default_label = 'Organism';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('obi__organism');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
 
   /**
    * @see TripalFieldFormatter::view()

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

@@ -3,7 +3,7 @@
 class obi__organism_widget extends TripalFieldWidget {
 
   // The default lable for this field.
-  public static $label = 'Organism';
+  public static $default_label = 'Organism';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('obi__organism');

+ 18 - 44
tripal_chado/includes/TripalFields/ogi__location_on_map/ogi__location_on_map.inc

@@ -11,16 +11,8 @@ class ogi__location_on_map extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  // http://www.ebi.ac.uk/ols/ontologies/ogi/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FOGI_0000021
-  public static $term = 'OGI:0000021';
-
   // The default lable for this field.
-  public static $label = 'Location on Map';
+  public static $default_label = 'Location on Map';
 
   // The default description for this field.
   public static $description = 'Map position of a sequence.';
@@ -28,7 +20,7 @@ class ogi__location_on_map extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -38,11 +30,25 @@ class ogi__location_on_map extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'OGI',
+    // The name of the term.
+    'term_name' => 'location on map',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '0000021',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'ogi__location_on_map_widget';
@@ -79,36 +85,4 @@ class ogi__location_on_map extends TripalField {
 
   }
 
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

+ 2 - 2
tripal_chado/includes/TripalFields/ogi__location_on_map/ogi__location_on_map_formatter.inc

@@ -2,13 +2,13 @@
 
 class ogi__location_on_map_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Location on Map';
+  public static $default_label = 'Location on Map';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('ogi__location_on_map');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()

+ 1 - 1
tripal_chado/includes/TripalFields/ogi__location_on_map/ogi__location_on_map_widget.inc

@@ -2,7 +2,7 @@
 
 class ogi__location_on_map_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Location on Map';
+  public static $default_label = 'Location on Map';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('ogi__location_on_map');

+ 22 - 48
tripal_chado/includes/TripalFields/sbo__database_cross_reference/sbo__database_cross_reference.inc

@@ -11,15 +11,8 @@ class sbo__database_cross_reference extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'SBO:0000554';
-
   // The default lable for this field.
-  public static $label = 'Database cross reference';
+  public static $default_label = 'Database cross reference';
 
   // The default description for this field.
   public static $description = 'This record can be cross referenced with a record in
@@ -29,7 +22,7 @@ class sbo__database_cross_reference extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -39,11 +32,25 @@ class sbo__database_cross_reference extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'SBO',
+    // The name of the term.
+    'term_name' => 'Database Cross Reference',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '0000554',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'sbo__database_cross_reference_widget';
@@ -78,18 +85,18 @@ class sbo__database_cross_reference extends TripalField {
    */
   public function load($entity, $details = array()) {
     $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'];
     $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];
-    
+
     // Set some defaults for the empty record.
     $entity->{$field_name}['und'][0] = array(
       'value' => array(),
@@ -102,7 +109,7 @@ class sbo__database_cross_reference extends TripalField {
       'version' => '',
       'description' => '',
     );
-    
+
     $linker_table = $base_table . '_dbxref';
     $options = array('return_array' => 1);
     $record = chado_expand_var($record, 'table', $linker_table, $options);
@@ -130,39 +137,6 @@ class sbo__database_cross_reference extends TripalField {
       }
     }
   }
-
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }
 
 /**

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

@@ -2,13 +2,13 @@
 
 class sbo__database_cross_reference_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Database cross reference';
+  public static $default_label = 'Database cross reference';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('sbo__database_cross_reference');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()
@@ -37,7 +37,7 @@ class sbo__database_cross_reference_formatter extends TripalFieldFormatter {
         '#markup' => $content,
       );
     }
-    
+
     if (count($element) == 0) {
       $element[0] = array(
         '#type' => 'markup',

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

@@ -2,7 +2,7 @@
 
 class sbo__database_cross_reference_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Database cross reference';
+  public static $default_label = 'Database cross reference';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('sbo__database_cross_reference');

+ 25 - 51
tripal_chado/includes/TripalFields/sbo__phenotype/sbo__phenotype.inc

@@ -11,26 +11,18 @@ class sbo__phenotype extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  // http://www.ebi.ac.uk/sbo/main/SBO:0000358
-  public static $term = 'SBO:0000358';
-
   // The default lable for this field.
-  public static $label = 'Phenotype';
+  public static $default_label = 'Phenotype';
 
   // The default description for this field.
-  public static $description = 'A biochemical network can generate phenotypes or affects 
-      biological processes. Such processes can take place at different levels and are 
+  public static $description = 'A biochemical network can generate phenotypes or affects
+      biological processes. Such processes can take place at different levels and are
       independent of the biochemical network itself.';
 
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -40,11 +32,25 @@ class sbo__phenotype extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'SBO',
+    // The name of the term.
+    'term_name' => 'Phenotype',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '0000358',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'sbo__phenotype_widget';
@@ -83,15 +89,15 @@ class sbo__phenotype extends TripalField {
     $field_type = $this->field['type'];
     $field_table = $this->field['settings']['chado_table'];
     $field_column = $this->field['settings']['chado_column'];
-    
+
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);
     $base_table = $details['record']->tablename;
     $pkey = $schema['primary key'][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(),
@@ -100,7 +106,7 @@ class sbo__phenotype extends TripalField {
       $field_table . '__' . 'phenotype_id' => '',
       // Ignore the synonym_sgml column for now.
     );
-    
+
     $linker_table = $base_table . '_phenotype';
     $options = array(
       'return_array' => 1,
@@ -131,7 +137,7 @@ class sbo__phenotype extends TripalField {
           $field_table . '__' . $fkey_lcolumn => $phenotype_linker->$fkey_lcolumn->$fkey_lcolumn,
           $field_table . '__' . 'phenotype_id' => $phenotype->phenotype_id
         );
-    
+
         if ($phenotype && property_exists($phenotype, 'entity_id')) {
           $entity->{$field_name}['und'][$i]['value']['entity'] = 'TripalEntity:' . $phenotype->entity_id;
         }
@@ -139,36 +145,4 @@ class sbo__phenotype extends TripalField {
     }
   }
 
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

+ 7 - 7
tripal_chado/includes/TripalFields/sbo__phenotype/sbo__phenotype_formatter.inc

@@ -2,13 +2,13 @@
 
 class sbo__phenotype_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Phenotype';
+  public static $default_label = 'Phenotype';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('sbo__phenotype');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()
@@ -24,21 +24,21 @@ class sbo__phenotype_formatter extends TripalFieldFormatter {
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
     // Get the settings
     $settings = $display['settings'];
-    
+
     $headers = array('Name', 'Value', 'Type');
     $rows = array();
-    
+
     foreach ($items as $delta => $item) {
       $phenotype = $item['value'];
       if (!$phenotype) {
         continue;
       }
-    
+
       // Get the field values
       $phenotype_name = $phenotype['name'];
       $value = $phenotype['value'];
       $type = $phenotype['type'];
-    
+
       // Add a link i there is an entity.
       if (array_key_exists('entity', $item['value']) and $item['value']['entity']) {
         list($entity_type, $entity_id) = explode(':', $item['value']['entity']);
@@ -59,7 +59,7 @@ class sbo__phenotype_formatter extends TripalFieldFormatter {
       'empty' => 'No phenotypes available',
     );
     $content = theme_table($table);
-    
+
     // once we have our table array structure defined, we call Drupal's theme_table()
     // function to generate the table.
     if (count($items) > 0) {

+ 1 - 1
tripal_chado/includes/TripalFields/sbo__phenotype/sbo__phenotype_widget.inc

@@ -2,7 +2,7 @@
 
 class sbo__phenotype_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Phenotype';
+  public static $default_label = 'Phenotype';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('sbo__phenotype');

+ 18 - 26
tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship.inc

@@ -11,15 +11,8 @@ class sbo__relationship extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'SBO:0000374';
-
   // The default lable for this field.
-  public static $label = 'Relationship';
+  public static $default_label = 'Relationship';
 
   // The default description for this field.
   public static $description = 'Relationships between records.';
@@ -27,7 +20,7 @@ class sbo__relationship extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +30,25 @@ class sbo__relationship extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'SBO',
+    // The name of the term.
+    'term_name' => 'Relationship',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '0000374',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'sbo__relationship_widget';
@@ -574,19 +581,4 @@ class sbo__relationship extends TripalField {
         }
   }
 
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

+ 11 - 11
tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship_formatter.inc

@@ -2,13 +2,13 @@
 
 class sbo__relationship_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Relationship';
+  public static $default_label = 'Relationship';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('sbo__relationship');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()
@@ -24,11 +24,11 @@ class sbo__relationship_formatter extends TripalFieldFormatter {
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
     // Get the settings
     $settings = $display['settings'];
-    
+
     $rows = array();
     $headers = array('Subject' ,'Type', 'Object');
     $headers = array('Relationship');
-    
+
     foreach ($items as $delta => $item) {
       if (!$item['value']) {
         continue;
@@ -38,7 +38,7 @@ class sbo__relationship_formatter extends TripalFieldFormatter {
       $object_name = $item['value']['object']['name'];
       $object_type = $item['value']['object']['type'];
       $phrase = $item['value']['phrase'];
-    
+
       // Handle some special cases.
       // For mRNA objects we don't want to show the CDS, exons, 5' UTR, etc.
       // we want to show the parent gene and the protein.
@@ -48,10 +48,10 @@ class sbo__relationship_formatter extends TripalFieldFormatter {
       if ($subject_type == 'mRNA' and ($object_type != 'gene')) {
         continue;
       }
-    
+
       $phrase = preg_replace("/$subject_type/", "<b>$subject_type</b>", $phrase);
       $phrase = preg_replace("/$object_type/", "<b>$object_type</b>", $phrase);
-    
+
       if (array_key_exists('entity', $item['value']['object'])) {
         list($entity_type, $object_entity_id) = explode(':', $item['value']['object']['entity']);
         if ($object_entity_id != $entity->id) {
@@ -66,11 +66,11 @@ class sbo__relationship_formatter extends TripalFieldFormatter {
           $phrase = preg_replace("/$subject_name/", $link, $phrase);
         }
       }
-    
+
       $rows[] = array($phrase);
     }
-    
-    
+
+
     // the $table array contains the headers and rows array as well as other
     // options for controlling the display of the table.  Additional
     // documentation can be found here:
@@ -87,7 +87,7 @@ class sbo__relationship_formatter extends TripalFieldFormatter {
       'colgroups' => array(),
       'empty' => 'There are no relationships',
     );
-    
+
     // once we have our table array structure defined, we call Drupal's theme_table()
     // function to generate the table.
     if (count($items) > 0) {

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

@@ -2,7 +2,7 @@
 
 class sbo__relationship_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Relationship';
+  public static $default_label = 'Relationship';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('sbo__relationship');

+ 23 - 48
tripal_chado/includes/TripalFields/schema__alternate_name/schema__alternate_name.inc

@@ -11,15 +11,8 @@ class schema__alternate_name extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'schema:alternateName';
-
   // The default lable for this field.
-  public static $label = 'Synonyms';
+  public static $default_label = 'Synonyms';
 
   // The default description for this field.
   public static $description = 'Adds an alternative name (synonym or alias) to this record.';
@@ -27,7 +20,7 @@ class schema__alternate_name extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +30,25 @@ class schema__alternate_name extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'schema',
+    // The name of the term.
+    'term_name' => 'alternateName',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'alternateName',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'schema__alternate_name_widget';
@@ -77,21 +84,21 @@ class schema__alternate_name extends TripalField {
   public function load($entity, $details = array()) {
     $record = $details['record'];
     $base_table = $this->field['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'];
-    
+
     // Get the PKey for this table
     $schema = chado_get_schema($field_table);
     $pkey = $schema['primary key'][0];
-    
+
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);
     $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(),
@@ -105,7 +112,7 @@ class schema__alternate_name extends TripalField {
       'type_id' => '',
       // Ignore the synonym_sgml column for now.
     );
-    
+
     $linker_table = $base_table . '_synonym';
     $options = array('return_array' => 1);
     $record = chado_expand_var($record, 'table', $linker_table, $options);
@@ -133,36 +140,4 @@ class schema__alternate_name extends TripalField {
     }
   }
 
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

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

@@ -2,13 +2,13 @@
 
 class schema__alternate_name_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Synonyms';
+  public static $default_label = 'Synonyms';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('schema__alternate_name');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()

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

@@ -2,7 +2,7 @@
 
 class schema__alternate_name_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Synonyms';
+  public static $default_label = 'Synonyms';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('schema__alternate_name');

+ 25 - 50
tripal_chado/includes/TripalFields/schema__publication/schema__publication.inc

@@ -11,15 +11,8 @@ class schema__publication extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'schema:publication';
-
   // The default lable for this field.
-  public static $label = 'Publication';
+  public static $default_label = 'Publication';
 
   // The default description for this field.
   public static $description = 'Associates a publication (e.g. journal article,
@@ -28,7 +21,7 @@ class schema__publication extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -38,11 +31,25 @@ class schema__publication extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'schema',
+    // The name of the term.
+    'term_name' => 'publication',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => 'publication',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'schema__publication_widget';
@@ -77,19 +84,19 @@ class schema__publication extends TripalField {
    */
   public function load($entity, $details = array()) {
     $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'];
     $base_table = $this->field['settings']['base_table'];
-    
+
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);
     $pkey = $schema['primary key'][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(),
@@ -98,13 +105,13 @@ class schema__publication extends TripalField {
       'chado-' . $field_table . '__' . 'pub_id' => '',
       'uniquename' => '',
     );
-    
+
     $linker_table = $base_table . '_pub';
     $options = array(
       'return_array' => 1,
     );
     $record = chado_expand_var($record, 'table', $linker_table, $options);
-    
+
     if (count($record->$linker_table) > 0) {
       $i = 0;
       foreach ($record->$linker_table as $index => $linker) {
@@ -112,13 +119,13 @@ class schema__publication extends TripalField {
         $pub_details = tripal_get_minimal_pub_info($pub);
         $pub_details['@type'] = $pub->type_id->dbxref_id->db_id->name . ':' . $pub->type_id->dbxref_id->accession;
         $pub_details['publication']['type'] = $pub->type_id->name;
-    
+
         $entity->{$field_name}['und'][$i]['value'] = $pub_details;
         $entity->{$field_name}['und'][$i]['chado-' . $field_table . '__' . $pkey] = $linker->$pkey;
         $entity->{$field_name}['und'][$i]['chado-' . $field_table . '__' . $fkey_lcolumn] = $linker->$fkey_lcolumn->$fkey_lcolumn;
         $entity->{$field_name}['und'][$i]['chado-' . $field_table . '__' . 'pub_id'] = $pub->pub_id;
         $entity->{$field_name}['und'][$i]['uniquename'] =  $pub->uniquename;
-    
+
         if (property_exists($pub, 'entity_id')) {
           $entity->{$field_name}['und'][$i]['value']['entity'] = 'TripalEntity:' . $pub->entity_id;
         }
@@ -127,36 +134,4 @@ class schema__publication extends TripalField {
     }
   }
 
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

+ 2 - 2
tripal_chado/includes/TripalFields/schema__publication/schema__publication_formatter.inc

@@ -2,13 +2,13 @@
 
 class schema__publication_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Publication';
+  public static $default_label = 'Publication';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('schema__publication');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()

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

@@ -2,7 +2,7 @@
 
 class schema__publication_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Publication';
+  public static $default_label = 'Publication';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('schema__publication');

+ 18 - 11
tripal_chado/includes/TripalFields/so__cds/so__cds.inc

@@ -11,15 +11,8 @@ class so__cds extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'SO:0000316';
-
   // The default lable for this field.
-  public static $label = 'Coding Sequence';
+  public static $default_label = 'Coding Sequence';
 
   // The default description for this field.
   public static $description = 'A contiguous sequence which begins with, and includes, a start codon and ends with, and includes, a stop codon.';
@@ -27,7 +20,7 @@ class so__cds extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +30,25 @@ class so__cds extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'SO',
+    // The name of the term.
+    'term_name' => 'CDS',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '0000316',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'so__cds_widget';

+ 2 - 2
tripal_chado/includes/TripalFields/so__cds/so__cds_formatter.inc

@@ -2,13 +2,13 @@
 
 class so__cds_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Coding Sequence';
+  public static $default_label = 'Coding Sequence';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('so__cds');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
 
   /**
    * @see TripalFieldFormatter::view()

+ 1 - 1
tripal_chado/includes/TripalFields/so__cds/so__cds_widget.inc

@@ -2,7 +2,7 @@
 
 class so__cds_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Coding Sequence';
+  public static $default_label = 'Coding Sequence';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('so__cds');

+ 23 - 48
tripal_chado/includes/TripalFields/so__genotype/so__genotype.inc

@@ -11,15 +11,8 @@ class so__genotype extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'SO:0001027';
-
   // The default lable for this field.
-  public static $label = 'Genotype';
+  public static $default_label = 'Genotype';
 
   // The default description for this field.
   public static $description = 'Associates an indviddual or organization with
@@ -28,7 +21,7 @@ class so__genotype extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -38,11 +31,25 @@ class so__genotype extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'SO',
+    // The name of the term.
+    'term_name' => 'Genotype',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '0001027',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'so__genotype_widget';
@@ -81,15 +88,15 @@ class so__genotype extends TripalField {
     $field_type = $this->field['type'];
     $field_table = $this->field['settings']['chado_table'];
     $field_column = $this->field['settings']['chado_column'];
-    
+
     // Get the FK that links to the base record.
     $schema = chado_get_schema($field_table);
     $base_table = $details['record']->tablename;
     $pkey = $schema['primary key'][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(),
@@ -98,7 +105,7 @@ class so__genotype extends TripalField {
       $field_table . '__' . 'genotype_id' => '',
       // Ignore the synonym_sgml column for now.
     );
-    
+
     $linker_table = $base_table . '_genotype';
     $options = array(
       'return_array' => 1,
@@ -129,7 +136,7 @@ class so__genotype extends TripalField {
           $field_table . '__' . $fkey_lcolumn => $genotype_linker->$fkey_lcolumn->$fkey_lcolumn,
           $field_table . '__' . 'genotype_id' => $genotype->genotype_id
         );
-    
+
         if ($genotype && property_exists($genotype, 'entity_id')) {
           $entity->{$field_name}['und'][$i]['value']['entity'] = 'TripalEntity:' . $genotype->entity_id;
         }
@@ -137,36 +144,4 @@ class so__genotype extends TripalField {
     }
   }
 
-
-  /**
-   *
-   * @see TripalField::settingsForm()
-   */
-  public function settingsForm($has_data) {
-
-  }
-  /**
-   *
-   * @param unknown $form
-   * @param unknown $form_state
-   */
-  public function settingsFormValidate($form, &$form_state) {
-
-  }
-
-  /**
-   *
-   * @see TripalField::instanceSettingsForm()
-   */
-  public function instanceSettingsForm() {
-
-  }
-  /**
-   *
-   * @see TripalField::instanceSettingsFormValidate()
-   */
-  public function instanceSettingsFormValidate($form, &$form_state) {
-
-  }
-
 }

+ 7 - 7
tripal_chado/includes/TripalFields/so__genotype/so__genotype_formatter.inc

@@ -2,13 +2,13 @@
 
 class so__genotype_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Genotype';
+  public static $default_label = 'Genotype';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('so__genotype');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()
@@ -24,21 +24,21 @@ class so__genotype_formatter extends TripalFieldFormatter {
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
     // Get the settings
     $settings = $display['settings'];
-    
+
     $headers = array('Name', 'Description', 'Type');
     $rows = array();
-    
+
     foreach ($items as $delta => $item) {
       $genotype = $item['value'];
       if (!$genotype) {
         continue;
       }
-    
+
       // Get the field values
       $genotype_name = $genotype['name'];
       $description = $genotype['description'];
       $type = $genotype['type'];
-    
+
       // Add a link i there is an entity.
       if (array_key_exists('entity', $item['value']) and $item['value']['entity']) {
         list($entity_type, $entity_id) = explode(':', $item['value']['entity']);
@@ -46,7 +46,7 @@ class so__genotype_formatter extends TripalFieldFormatter {
       }
       $rows[] = array($genotype_name, $description, $type);
     }
-    
+
     $table = array(
       'header' => $headers,
       'rows' => $rows,

+ 1 - 1
tripal_chado/includes/TripalFields/so__genotype/so__genotype_widget.inc

@@ -2,7 +2,7 @@
 
 class so__genotype_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Genotype';
+  public static $default_label = 'Genotype';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('so__genotype');

+ 18 - 11
tripal_chado/includes/TripalFields/so__transcript/so__transcript.inc

@@ -11,15 +11,8 @@ class so__transcript extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'SO:0000673';
-
   // The default lable for this field.
-  public static $label = 'Transcripts';
+  public static $default_label = 'Transcripts';
 
   // The default description for this field.
   public static $description = 'An RNA synthesized on a DNA or RNA template by an RNA polymerase.';
@@ -27,7 +20,7 @@ class so__transcript extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +30,25 @@ class so__transcript extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'SO',
+    // The name of the term.
+    'term_name' => 'transcript',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '0000673',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'so__transcript_widget';

+ 7 - 7
tripal_chado/includes/TripalFields/so__transcript/so__transcript_formatter.inc

@@ -2,13 +2,13 @@
 
 class so__transcript_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Transcript';
+  public static $default_label = 'Transcript';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('so__transcript');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
    *
    * @see TripalFieldFormatter::settingsForm()
@@ -25,22 +25,22 @@ class so__transcript_formatter extends TripalFieldFormatter {
 
     // Get the settings
     $settings = $display['settings'];
-    
+
     $headers = array('Transcript Name', 'Identifier', 'Type', 'Location');
     $rows = array();
     foreach ($items as $delta => $item) {
-    
+
       if (!$item['value']) {
         continue;
       }
       $transcript = $item['value'];
-    
+
       // Get the field values
       $feature_name = $transcript['name'];
       $feature_uname = $transcript['identifier'];
       $loc = $transcript['location'];
       $type = $transcript['type'];
-    
+
       // Add a link i there is an entity.
       if (array_key_exists('entity', $item['value']) and $item['value']['entity']) {
         list($entity_type, $entity_id) = explode(':', $item['value']['entity']);
@@ -61,7 +61,7 @@ class so__transcript_formatter extends TripalFieldFormatter {
       'empty' => 'This feature has no transcripts',
     );
     $content = theme_table($table);
-    
+
     // once we have our table array structure defined, we call Drupal's theme_table()
     // function to generate the table.
     if (count($items) > 0) {

+ 1 - 1
tripal_chado/includes/TripalFields/so__transcript/so__transcript_widget.inc

@@ -2,7 +2,7 @@
 
 class so__transcript_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Transcript';
+  public static $default_label = 'Transcript';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('so__transcript');

+ 21 - 14
tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon.inc

@@ -11,15 +11,8 @@ class taxrank__infraspecific_taxon extends TripalField {
   // the field and it's default widget and formatter.
   // --------------------------------------------------------------------------
 
-  // The term that this field maps to.  The format for the term should be:
-  // [vocab]:[accession] where [vocab] is the short name of the vocabulary
-  // and [acession] is the unique accession number for the term.  This term
-  // must already exist in the vocabulary storage backend. This
-  // value should never be changed once fields exist for this type.
-  public static $term = 'TAXRANK:0000046';
-
   // The default lable for this field.
-  public static $label = 'Infraspecific Taxon';
+  public static $default_label = 'Infraspecific Taxon';
 
   // The default description for this field.
   public static $description = 'Specifies the infraspecific taxon of an organism.';
@@ -27,7 +20,7 @@ class taxrank__infraspecific_taxon extends TripalField {
   // Provide a list of global settings. These can be accessed witihn the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
-  public static $settings = array(
+  public static $default_settings = array(
     'chado_table' => '',
     'chado_column' => '',
     'base_table' => '',
@@ -37,11 +30,25 @@ class taxrank__infraspecific_taxon extends TripalField {
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted
   // then Drupal with automatically change these settings for the instnace.
   // It is recommended to put settings at the instance level whenever possible.
-  public static $instance_settings  = array();
+  // If you override this variable in a child class be sure to replicate the
+  // term_name, term_vocab, term_accession and term_fixed keys as these are
+  // required for all TripalFields.
+  public static $default_instance_settings  = array(
+    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
+    'term_vocabulary' => 'TAXRANK',
+    // The name of the term.
+    'term_name' => 'infraspecific_taxon',
+    // The unique ID (i.e. accession) of the term.
+    'term_accession' => '0000046',
+    // Set to TRUE if the site admin is allowed to change the term
+    // 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,
+  );
 
   // Set this to the name of the storage backend that by default will support
   // this field.
-  public static $storage = 'tripal_no_storage';
+  public static $storage = 'field_chado_storage';
 
   // The default widget for this field.
   public static $default_widget = 'HERE_widget';
@@ -77,18 +84,18 @@ class taxrank__infraspecific_taxon extends TripalField {
   public function load($entity, $details = array()) {
     $record = $details['record'];
     $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'];
-    
+
     // Set some defaults for the empty record.
     $entity->{$field_name}['und'][0] = array(
       'value' => '',
       'organism__type_id' => '',
     );
-    
+
     if ($record->type_id) {
       $entity->{$field_name}['und'][0]['value'] = $record->type_id->name;
       $entity->{$field_name}['und'][0]['organism__type_id'] = $record->type_id->cvterm_id;

+ 4 - 4
tripal_chado/includes/TripalFields/taxrank__infraspecific_taxon/taxrank__infraspecific_taxon_formatter.inc

@@ -2,15 +2,15 @@
 
 class taxrank__infraspecific_taxon_formatter extends TripalFieldFormatter {
   // The default lable for this field.
-  public static $label = 'Infraspecific Taxon';
+  public static $default_label = 'Infraspecific Taxon';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('taxrank__infraspecific_taxon');
 
   // The list of default settings for this formatter.
-  public static $settings = array();
+  public static $default_settings = array();
   /**
-   * 
+   *
    * @see TripalFieldFormatter::settingsForm()
    */
   public function settingsForm($view_mode, $form, &$form_state) {
@@ -18,7 +18,7 @@ class taxrank__infraspecific_taxon_formatter extends TripalFieldFormatter {
   }
 
   /**
-   * 
+   *
    * @see TripalFieldFormatter::view()
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {

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

@@ -2,7 +2,7 @@
 
 class taxrank__infraspecific_taxon_widget extends TripalFieldWidget {
   // The default lable for this field.
-  public static $label = 'Infraspecific Taxon';
+  public static $default_label = 'Infraspecific Taxon';
 
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('taxrank__infraspecific_taxon');