#1207680 by damz: Don't validate if there are no options set, the values are empty...
authorDaniel Wehner
Tue, 12 Jul 2011 15:13:12 +0000 (17:13 +0200)
committerDaniel Wehner
Tue, 12 Jul 2011 15:13:20 +0000 (17:13 +0200)
handlers/views_handler_filter_in_operator.inc
modules/taxonomy/views_handler_filter_term_node_tid.inc

index 244b53e..fb3c0d5 100644 (file)
@@ -376,6 +376,15 @@ class views_handler_filter_in_operator extends views_handler_filter {
       $errors[] = t('The operator is invalud');
     }
     if (is_array($this->value)) {
+      if (!isset($this->value_options)) {
+        // Don't validate if there are none value options provided, for example for special handlers.
+        return $errors;
+      }
+      if ($this->options['exposed'] && !$this->options['expose']['required'] && empty($this->value)) {
+        // Don't validate if the field is exposed and no default value is provided.
+        return $errors;
+      }
+
       // Remove every element which is not known.
       foreach ($this->value as $value) {
         if (!isset($this->value_options[$value])) {
index e0d3ec2..5c440c3 100644 (file)
@@ -177,11 +177,6 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
     }
   }
 
-  function validate() {
-    // Override the validation handler defined by filter_in_operator and do nothing.
-    // @todo: Someone could refactor this handler to support get_value_options and do some custom validation for the autocompletion here.
-  }
-
   function value_validate($form, &$form_state) {
     // We only validate if they've chosen the text field style.
     if ($this->options['type'] != 'textfield') {