Quellcode durchsuchen

Merge pull request #521 from tripal/data__sequence_coordinates

Bug Fix: Sequence Coordinates field only showed the last location.
Bradford Condon vor 6 Jahren
Ursprung
Commit
328efb0fd7

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

@@ -248,7 +248,7 @@ class data__sequence_coordinates extends ChadoField {
         }
         $fmin = $featureloc->fmin + 1;
         $fmax = $featureloc->fmax;
-        $entity->{$field_name}['und'][0] = array(
+        $entity->{$field_name}['und'][$index] = array(
           'value' => array(
             $description => $srcfeature . ':' . $fmin . '-' . $fmax . $strand,
             $reference_term => $srcfeature,
@@ -265,4 +265,4 @@ class data__sequence_coordinates extends ChadoField {
       }
     }
   }
-}
+}

+ 6 - 3
tripal_chado/includes/TripalFields/data__sequence_coordinates/data__sequence_coordinates_formatter.inc

@@ -20,7 +20,7 @@ class data__sequence_coordinates_formatter extends ChadoFieldFormatter {
     $strand_term = chado_get_semweb_term('featureloc', 'strand');
     $phase_term = chado_get_semweb_term('featureloc', 'phase');
 
-    $content = '';
+    $locations = array();
     foreach ($items as $item) {
       if (!empty($item['value'])) {
         $srcfeature = $item['value'][$reference_term];
@@ -28,12 +28,15 @@ class data__sequence_coordinates_formatter extends ChadoFieldFormatter {
         $fmax = $item['value'][$fmax_term];
         $phase = $item['value'][$phase_term];
         $strand = $item['value'][$strand_term];
-        $content .= $srcfeature . ':' . $fmin . '..' . $fmax . $strand;
+        $locations[] = $srcfeature . ':' . $fmin . '..' . $fmax . $strand;
       }
     }
-    if (!$content) {
+    if (!$locations) {
       $content = 'This feature is not located on any sequence.';
     }
+    else {
+      $content = implode('<br />', $locations);
+    }
     $element[0] = array(
       '#type' => 'markup',
       '#markup' => $content,