Browse Source

Issue #72: Updating API to include 2.1 improvements: 9fc326e

Stephen Ficklin 7 years ago
parent
commit
29e27680a5

+ 17 - 11
legacy/tripal_core/api/tripal_core.chado_nodes.title_and_path.inc

@@ -1304,12 +1304,14 @@ function chado_node_generate_tokens($base_table, $token_prefix = FALSE, $locatio
  * @return
  *   The value of the token
  */
-function chado_get_token_value($token_info, $node) {
+function chado_get_token_value($token_info, $node, $options = array()) {
 
   $token = $token_info['token'];
   $table = $token_info['table'];
   $var = $node;
 
+  $supress_errors = (isset($options['supress_errors'])) ? $options['supress_errors'] : FALSE;
+
   // Iterate through each portion of the location string. An example string
   // might be:  stock > type_id > name.
   $location = explode('>', $token_info['location']);
@@ -1325,11 +1327,13 @@ function chado_get_token_value($token_info, $node) {
         $var = $var->$index;
       }
       else {
-        tripal_report_error('chado_node_api', TRIPAL_WARNING,
-          'Tokens: Unable to determine the value of %token. Things went awry when trying ' .
-          'to access \'%index\' for the following: \'%var\'.',
-          array('%token' => $token, '%index' => $index, '%var' => print_r($var,TRUE))
-        );
+        if (!$supress_errors) {
+          tripal_report_error('chado_node_api', TRIPAL_WARNING,
+            'Tokens: Unable to determine the value of %token. Things went awry when trying ' .
+            'to access \'%index\' for the following: \'%var\'.',
+            array('%token' => $token, '%index' => $index, '%var' => print_r($var,TRUE))
+          );
+        }
         return '';
       }
     }
@@ -1339,11 +1343,13 @@ function chado_get_token_value($token_info, $node) {
       $var = $var[$index];
     }
     else {
-      tripal_report_error('chado_node_api', TRIPAL_WARNING,
-        'Tokens: Unable to determine the value of %token. Things went awry when trying ' .
-        'to access \'%index\' for the following: \'%var\'.',
-        array('%token' => $token, '%index' => $index, '%var' => print_r($var,TRUE))
-      );
+      if (!$supress_errors) {
+        tripal_report_error('chado_node_api', TRIPAL_WARNING,
+          'Tokens: Unable to determine the value of %token. Things went awry when trying ' .
+          'to access \'%index\' for the following: \'%var\'.',
+          array('%token' => $token, '%index' => $index, '%var' => print_r($var,TRUE))
+        );
+      }
       return '';
     }
   }

+ 0 - 1
legacy/tripal_core/tripal_core.info

@@ -11,7 +11,6 @@ scripts[]          = theme/js/tripal_core.js
 
 dependencies[] = views
 dependencies[] = path
-dependencies[] = search
 dependencies[] = php
 dependencies[] = tripal
 dependencies[] = tripal_chado