소스 검색

small fix to 'No Results' filter: bug where all filters returned arrays was causing views to never execute. Now if all filters return arrays, assumes it should return all (essentially the filter reverts to not changing anything in this case) in this case. If there is at least one textfield then this filter functions as before

Lacey Sanderson 12 년 전
부모
커밋
a8c67af75b
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 1
      tripal_views/views/handlers/tripal_views_handler_filter_no_results.inc

+ 11 - 1
tripal_views/views/handlers/tripal_views_handler_filter_no_results.inc

@@ -47,7 +47,17 @@ class tripal_views_handler_filter_no_results extends views_handler_filter {
   function query() {
     global $base_url;
 
-    if (empty($this->view->exposed_input)) {
+    // Check that all filter types don't return arrays
+    // 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 (empty($this->view->exposed_input) && !$all_arrays) {
       $this->view->executed = TRUE;
 
       $jquery_loaded = FALSE;