Browse Source

Small fixes to some of the basic views handlers. Need to ensure that values are arrays before looping and that aliases exist before using

Lacey Sanderson 12 years ago
parent
commit
acf539de59

+ 3 - 1
tripal_views/views/handlers/chado_views_handler_field.inc

@@ -133,7 +133,9 @@ class chado_views_handler_field extends views_handler_field {
   function render_node_link($link_text, $values) {
 
     $node_field = $this->view->field['nid'];
-    $nid = $values->{$node_field->aliases['nid']};
+    if (isset($node_field->aliases['nid'])) {
+      $nid = $values->{$node_field->aliases['nid']};
+    }
 
     if ($nid) {
       return l($link_text, 'node/' . $nid);

+ 8 - 3
tripal_views/views/handlers/tripal_views_handler_filter_no_results.inc

@@ -51,11 +51,16 @@ class tripal_views_handler_filter_no_results extends views_handler_filter {
     // If they do then just show results by default b/c there is no way to tell the
     // different between before and after submitted
     $all_arrays = TRUE;
-    foreach ($this->view->exposed_raw_input as $v) {
-      if (!is_array($v)) {
-        $all_arrays = FALSE;
+    if (is_array($this->view->exposed_raw_input)) {
+      foreach ($this->view->exposed_raw_input as $v) {
+        if (!is_array($v)) {
+          $all_arrays = FALSE;
+        }
       }
     }
+    else {
+      $all_arrays = FALSE;
+    }
 
     if (empty($this->view->exposed_input) && !$all_arrays) {
       $this->view->executed = TRUE;