Browse Source

Made all non base fields indicate when no value is present for uniformity

Stephen Ficklin 8 years ago
parent
commit
f3c3e8c5a4

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

@@ -55,7 +55,7 @@ class chado_linker__contact_formatter extends ChadoFieldFormatter {
       'sticky' => FALSE,
       'caption' => "",
       'colgroups' => array(),
-      'empty' => 'No contacts available',
+      'empty' => 'There are no contacts available.',
     );
     $content = theme_table($table);
 

+ 8 - 5
tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop_formatter.inc

@@ -24,11 +24,14 @@ class chado_linker__prop_formatter extends ChadoFieldFormatter {
     $field_name = $this->field['field_name'];
     $chado_table = $this->instance['settings']['chado_table'];
 
-    foreach ($items as $delta => $item) {
-      $element[$delta] = array(
-        '#type' => 'markup',
-        '#markup' => $item['value'],
-      );
+    $content = '';
+    if ($items[0]['value']) {
+      $content = $items[0]['value'];
     }
+    $element[0] = array(
+      // We create a render array to produce the desired markup,
+      '#type' => 'markup',
+      '#markup' => $content,
+    );
   }
 }

+ 8 - 5
tripal_chado/includes/TripalFields/data__accession/data__accession_formatter.inc

@@ -13,11 +13,14 @@ class data__accession_formatter extends ChadoFieldFormatter {
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
 
-    foreach ($items as $delta => $item) {
-        $element[$delta] = array(
-          '#type' => 'markup',
-          '#markup' => $item['value'],
-        );
+    $content = 'N/A';
+    if ($items[0]['value']) {
+      $content = $items[0]['value'];
     }
+    $element[0] = array(
+      // We create a render array to produce the desired markup,
+      '#type' => 'markup',
+      '#markup' => $content,
+    );
   }
 }

+ 9 - 14
tripal_chado/includes/TripalFields/data__sequence/data__sequence_formatter.inc

@@ -17,23 +17,18 @@ class data__sequence_formatter extends ChadoFieldFormatter {
    * @param unknown $display
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
-    $element[0] = array(
-      // We create a render array to produce the desired markup,
-      '#type' => 'markup',
-      '#markup' => '',
-    );
 
-    $num_bases = 50;
-    foreach ($items as $delta => $item) {
+    $content = 'There is no sequence.';
+    if ($items[0]['value']) {
+      $num_bases = 50;
       $content = '<pre class="residues-formatter">';
-      $content .= wordwrap($item['value'], $num_bases, "<br>", TRUE);
+      $content .= wordwrap($items[0]['value'], $num_bases, "<br>", TRUE);
       $content .= '</pre>';
-
-      $element[$delta] = array(
-        // We create a render array to produce the desired markup,
-        '#type' => 'markup',
-        '#markup' => $content,
-      );
     }
+    $element[0] = array(
+      // We create a render array to produce the desired markup,
+      '#type' => 'markup',
+      '#markup' => $content,
+    );
   }
 }

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

@@ -75,7 +75,7 @@ class go__gene_expression_formatter extends ChadoFieldFormatter {
       'sticky' => FALSE,
       'caption' => "",
       'colgroups' => array(),
-      'empty' => 'There is no curated expression data.',
+      'empty' => 'There is no expression data available.',
     );
     $content = theme_table($table);
     if (count($items) > 0) {

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

@@ -39,7 +39,7 @@ class sbo__database_cross_reference_formatter extends ChadoFieldFormatter {
     if (count($element) == 0) {
       $element[0] = array(
         '#type' => 'markup',
-        '#markup' => '',
+        '#markup' => 'There are no cross references.',
       );
     }
   }

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

@@ -20,11 +20,23 @@ class schema__alternate_name_formatter extends ChadoFieldFormatter {
    * @see TripalFieldFormatter::view()
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
+    $list_items = array();
     foreach ($items as $delta => $item) {
-      $element[$delta] = array(
-        '#type' => 'markup',
-        '#markup' => $item['value'],
+      $list_items[] = $item['value'];
+    }
+    $list = 'There are no synonyms.';
+    if (count($list_items) > 1) {
+      $list = array(
+        'title' => '',
+        'items' => $list_items,
+        'type' => 'ol',
+        'attributes' => array(),
       );
+      $list = theme_item_list($list);
     }
+    $element[0] = array(
+      '#type' => 'markup',
+      '#markup' => $list,
+    );
   }
 }

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

@@ -37,7 +37,7 @@ class schema__publication_formatter extends ChadoFieldFormatter {
 
     krsort($list_items, SORT_NUMERIC);
 
-    $list = '';
+    $list = 'There are no publications.';
     if (count($list_items) > 1) {
       $list = array(
         'title' => '',

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

@@ -55,7 +55,7 @@ class so__genotype_formatter extends ChadoFieldFormatter {
       'sticky' => FALSE,
       'caption' => "",
       'colgroups' => array(),
-      'empty' => 'No genotypes available.',
+      'empty' => 'There are no genotypes available.',
     );
     $content = theme_table($table);
     if (count($items) > 0) {

+ 8 - 5
tripal_chado/includes/TripalFields/uo__unit/uo__unit_formatter.inc

@@ -12,11 +12,14 @@ class uo__unit_formatter extends ChadoFieldFormatter {
    * @see TripalFieldFormatter::view()
   */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
-    if (count($items) > 0) {
-      $element[0] = array(
-        '#type' => 'markup',
-        '#markup' => $items[0]['value'],
-      );
+    $content = '';
+    if ($items[0]['value']) {
+      $content = $items[0]['value'];
     }
+    $element[0] = array(
+      // We create a render array to produce the desired markup,
+      '#type' => 'markup',
+      '#markup' => $content,
+    );
   }
 }