Browse Source

Fixed a few minor bugs

Stephen Ficklin 8 years ago
parent
commit
6f34c0b1d9

+ 11 - 5
tripal/api/tripal.entities.api.inc

@@ -565,13 +565,14 @@ function tripal_save_title_format($entity, $format) {
  *   A default title format.
  */
 function tripal_get_default_title_format($entity) {
-  $format = NULL;
+  $format = '';
 
   // Retrieve all available tokens.
   $tokens = tripal_get_entity_tokens($entity);
 
-  // A) Check to see if more informed modules have suggested a title for this type.
-  // Invoke hook_tripal_default_title_format() to get all suggestions from other modules.
+  // A) Check to see if more informed modules have suggested a title for this
+  //    type. Invoke hook_tripal_default_title_format() to get all suggestions
+  //    from other modules.
   $suggestions = module_invoke_all('tripal_default_title_format', $entity, $tokens);
   if ($suggestions) {
     // Use the suggestion with the lightest weight.
@@ -581,15 +582,19 @@ function tripal_get_default_title_format($entity) {
       if ($s['weight'] < $lightest_key) $lightest_key = $k;
     }
     $format = $suggestions[$lightest_key]['format'];
+    return $format;
   }
 
-  // B) Check to see if any fields contain "name" in the machine name and if so, use them.
+  // B) Check to see if any fields contain "name" in the machine name and if
+  //    so, use them.
   $name_fields = preg_grep('/name/', array_keys($tokens));
   if ($name_fields AND !$format) {
     $format = implode(', ', $name_fields);
+    return $format;
   }
 
-  // C) Generate our own ugly title by simply comma-separating all the required fields.
+  // C) Generate our own ugly title by simply comma-separating all the
+  //    required fields.
   if (!$format) {
     $tmp = array();
 
@@ -600,6 +605,7 @@ function tripal_get_default_title_format($entity) {
       }
     }
     $format = implode(', ', $tmp);
+    return $format;
   }
 
   return $format;

+ 1 - 1
tripal/includes/fields/content_type.inc

@@ -83,7 +83,7 @@ class content_type extends TripalField {
       ),
       'display' => array(
         'default' => array(
-          'label' => 'above',
+          'label' => 'inline',
           'type' => 'tripal_content_type_formatter',
           'settings' => array(),
         ),

+ 2 - 2
tripal_chado/includes/fields/chado_base__dbxref_id.inc

@@ -119,8 +119,8 @@ class chado_base__dbxref_id extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
-          'label' => 'above',
+        'default' => array(
+          'label' => 'inline',
           'type' => 'chado_base__dbxref_id_formatter',
           'settings' => array(),
         ),

+ 2 - 2
tripal_chado/includes/fields/chado_base__organism_id.inc

@@ -137,8 +137,8 @@ class chado_base__organism_id extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
-          'label' => 'above',
+        'default' => array(
+          'label' => 'inline',
           'type' => 'chado_base__organism_id_formatter',
           'settings' => array(),
         ),

+ 2 - 2
tripal_chado/includes/fields/chado_feature__md5checksum.inc

@@ -114,8 +114,8 @@ class chado_feature__md5checksum  extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
-          'label' => 'above',
+        'default' => array(
+          'label' => 'inline',
           'type' => 'chado_feature__md5checksum_formatter',
           'settings' => array(),
         ),

+ 9 - 3
tripal_chado/includes/fields/chado_feature__residues.inc

@@ -110,7 +110,7 @@ class chado_feature__residues extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_feature__residues_formatter',
           'settings' => array(),
@@ -147,9 +147,15 @@ class chado_feature__residues extends TripalField {
   static function formatterView(&$element, $entity_type, $entity, $field,
     $instance, $langcode, $items, $display) {
 
+
+    $element[0] = array(
+      // We create a render array to produce the desired markup,
+      '#type' => 'markup',
+      '#markup' => '',
+    );
+
     $num_bases = 50;
     $feature = $entity->chado_record;
-
     foreach ($items as $delta => $item) {
       // If there are no residues then skip this one.
       if (!is_array($item['value']) or !array_key_exists('residues', $item['value'])) {
@@ -242,7 +248,7 @@ class chado_feature__residues extends TripalField {
         $entity->{$field_name}['und'][$num_seqs]['value'] = array(
           '@type' => 'SO:0000110',
           'type' => 'sequence_feature',
-          'label' => 'Sequence',
+          'label' => 'Raw Sequence',
           'defline' => tripal_get_fasta_defline($feature, '', NULL, '', strlen($feature->residues)),
           'residues' => $feature->residues,
         );

+ 2 - 2
tripal_chado/includes/fields/chado_feature__seqlen.inc

@@ -110,8 +110,8 @@ class chado_feature__seqlen extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
-          'label' => 'above',
+        'default' => array(
+          'label' => 'inline',
           'type' => 'chado_feature__seqlen_formatter',
           'settings' => array(),
         ),

+ 1 - 1
tripal_chado/includes/fields/chado_gene__transcripts.inc

@@ -115,7 +115,7 @@ class chado_gene__transcripts extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_gene__transcripts_formatter',
           'settings' => array(),

+ 1 - 1
tripal_chado/includes/fields/chado_linker__contact.inc

@@ -120,7 +120,7 @@ class chado_linker__contact extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_linker__contact_formatter',
           'settings' => array(),

+ 2 - 2
tripal_chado/includes/fields/chado_linker__cvterm_adder.inc

@@ -110,7 +110,7 @@ class chado_linker__cvterm_addr extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_linker__cvterm_adder_formatter',
           'settings' => array(),
@@ -254,7 +254,7 @@ function chado_linker__cvterm_adder_widget_validate($element, &$form_state) {
           ),
         ),
         'display' => array(
-          'deafult' => array(
+          'default' => array(
             'label' => 'above',
             'type' => 'tripal_chado_cvterm_formatter',
             'settings' => array(),

+ 2 - 2
tripal_chado/includes/fields/chado_linker__dbxref.inc

@@ -127,8 +127,8 @@ class chado_linker__dbxref extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
-          'label' => 'above',
+        'default' => array(
+          'label' => 'inline',
           'type' => 'chado_linker__dbxref_formatter',
           'settings' => array(),
         ),

+ 23 - 19
tripal_chado/includes/fields/chado_linker__expression.inc

@@ -114,7 +114,7 @@ class chado_linker__expression extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_linker__expression_formatter',
           'settings' => array(),
@@ -160,13 +160,14 @@ class chado_linker__expression extends TripalField {
     $record = $entity->chado_record;
 
     $content = '';
+    $rows = array();
     foreach ($items as $delta => $item) {
       if (!$item['value']) {
         continue;
       }
       // Iterate through all of the children of the $item['value']. Add each
       // one as an independent row in the table.
-      $rows = array();
+
       foreach ($item['value'] as $key => $value) {
 
         // If this key is the name, then we want to link to the entity if one
@@ -199,25 +200,23 @@ class chado_linker__expression extends TripalField {
           $value
         );
       }
-      $table = array(
-        'header' => array(),
-        'rows' => $rows,
-        'attributes' => array(
-          'id' => 'tripal_linker-table-expression-object',
-          'class' => 'tripal-data-table'
-        ),
-        'sticky' => FALSE,
-        'caption' => "",
-        'colgroups' => array(),
-        'empty' => '',
-      );
-      $content .= theme_table($table);
     }
-
-
-    // once we have our table array structure defined, we call Drupal's theme_table()
-    // function to generate the table.
+    $table = array(
+      'header' => array('Name'),
+      'rows' => $rows,
+      'attributes' => array(
+        'id' => 'tripal_linker-table-expression-object',
+        'class' => 'tripal-data-table'
+      ),
+      'sticky' => FALSE,
+      'caption' => "",
+      'colgroups' => array(),
+      'empty' => 'There are no curated expression data.',
+    );
+    $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.
       $element[0] = array(
         '#type' => 'markup',
         '#markup' => $content,
@@ -243,6 +242,11 @@ class chado_linker__expression extends TripalField {
     $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(),
+    );
+
     $linker_table = $base_table . '_expression';
     $options = array(
       'return_array' => 1,

+ 1 - 1
tripal_chado/includes/fields/chado_linker__featureloc.inc

@@ -114,7 +114,7 @@ class chado_linker__featureloc extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_linker__featureloc_formatter',
           'settings' => array(),

+ 5 - 5
tripal_chado/includes/fields/chado_linker__genotype.inc

@@ -94,7 +94,7 @@ class chado_linker__genotype extends TripalField {
 
     return array(
       'field_name' => $this->field_name,
-      'type' => 'chado_feature__md5checksum',
+      'type' => 'chado_linker__genotype',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
       'storage' => array(
@@ -139,7 +139,7 @@ class chado_linker__genotype extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_linker__genotype_formatter',
           'settings' => array(),
@@ -179,6 +179,7 @@ class chado_linker__genotype extends TripalField {
       }
       $rows[] = array($genotype_name, $description, $type);
     }
+
     $table = array(
       'header' => $headers,
       'rows' => $rows,
@@ -192,10 +193,9 @@ class chado_linker__genotype extends TripalField {
       'empty' => 'No genotypes 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) {
+      // once we have our table array structure defined, we call Drupal's theme_table()
+      // function to generate the table.
       $element[0] = array(
         '#type' => 'markup',
         '#markup' => $content,

+ 1 - 1
tripal_chado/includes/fields/chado_linker__phenotype.inc

@@ -139,7 +139,7 @@ class chado_linker__phenotype extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_linker__phenotype_formatter',
           'settings' => array(),

+ 3 - 3
tripal_chado/includes/fields/chado_linker__prop_adder.inc

@@ -109,7 +109,7 @@ class chado_linker__prop_adder extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_linker__prop_adder_formatter',
           'settings' => array(),
@@ -249,8 +249,8 @@ function chado_linker__prop_adder_widget_validate($element, &$form_state) {
                 ),
               ),
               'display' => array(
-                'deafult' => array(
-                  'label' => 'above',
+                'default' => array(
+                  'label' => 'inline',
                   'type' => 'tripal_chado_kvproperty_formatter',
                   'settings' => array(),
                 ),

+ 1 - 1
tripal_chado/includes/fields/chado_linker__pub.inc

@@ -114,7 +114,7 @@ class chado_linker_pub extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_linker__pub_formatter',
           'settings' => array(),

+ 2 - 2
tripal_chado/includes/fields/chado_linker__relationship.inc

@@ -111,7 +111,7 @@ class chado_linker__relationship extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
+        'default' => array(
           'label' => 'above',
           'type' => 'chado_linker__relationship_formatter',
           'settings' => array(),
@@ -732,7 +732,7 @@ class chado_linker__relationship extends TripalField {
       foreach ($srelationships as $relationship) {
         $rel_acc = $relationship->type_id->dbxref_id->db_id->name . ':' . $relationship->type_id->dbxref_id->accession;
         $rel_type = $relationship->type_id->name;
-        $verb = $this->get_rel_verb($rel_type);
+        $verb = self::get_rel_verb($rel_type);
         $subject_name = $relationship->subject_id->name;
         $subject_type = $relationship->subject_id->type_id->name;
         $object_name = $relationship->object_id->name;

+ 2 - 2
tripal_chado/includes/fields/chado_organism__type_id.inc

@@ -111,8 +111,8 @@ class chado_organism__type_id extends TripalField {
         ),
       ),
       'display' => array(
-        'deafult' => array(
-          'label' => 'above',
+        'default' => array(
+          'label' => 'inline',
           'type' => 'chado_organism__type_id_formatter',
           'settings' => array(),
         ),

+ 1 - 1
tripal_chado/includes/tripal_chado.fields.inc

@@ -323,7 +323,7 @@ function tripal_chado_field_create_instance_info_base_defaults($bundle_name,
       ),
       'display' => array(
         'default' => array(
-          'label' => 'above',
+          'label' => 'inline',
           'settings' => array(),
         ),
       ),

+ 1 - 1
tripal_chado/includes/tripal_chado.semweb.inc

@@ -336,7 +336,7 @@ function tripal_chado_populate_vocab_SBO() {
     'id' => 'SBO:0000374',
     'name' => 'relationship',
     'cv_name' => 'sbo',
-    'definition' => 'connectedness between entities and/or interactions representing their relatedness or influence. [ src_code:NR ]',
+    'definition' => 'Connectedness between entities and/or interactions representing their relatedness or influence.',
   ));
 }