diff --git a/handlers/views_handler_argument_string.inc b/handlers/views_handler_argument_string.inc index dbb98fe..d9d1e45 100644 --- a/handlers/views_handler_argument_string.inc +++ b/handlers/views_handler_argument_string.inc @@ -32,6 +32,7 @@ class views_handler_argument_string extends views_handler_argument { $options['path_case'] = array('default' => 'none'); $options['transform_dash'] = array('default' => FALSE, 'bool' => TRUE); $options['break_phrase'] = array('default' => FALSE, 'bool' => TRUE); + $options['not'] = array('default' => FALSE, 'bool' => TRUE); if (!empty($this->definition['many to one'])) { $options['add_table'] = array('default' => FALSE, 'bool' => TRUE); @@ -123,6 +124,13 @@ class views_handler_argument_string extends views_handler_argument { '#default_value' => !empty($this->options['break_phrase']), '#fieldset' => 'more', ); + $form['not'] = array( + '#type' => 'checkbox', + '#title' => t('Exclude'), + '#description' => t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'), + '#default_value' => !empty($this->options['not']), + '#fieldset' => 'more', + ); } /** @@ -198,21 +206,19 @@ class views_handler_argument_string extends views_handler_argument { } if (count($this->value) > 1) { - $operator = 'IN'; + $operator = empty($this->options['not']) ? 'IN' : 'NOT IN'; $argument = $this->value; } else { - $operator = '='; + $operator = empty($this->options['not']) ? '=' : '!='; } if ($formula) { $placeholder = $this->placeholder(); - if ($operator == 'IN') { - $field .= " IN($placeholder)"; - } - else { - $field .= ' = ' . $placeholder; + if (count($this->value) > 1) { + $placeholder = "($placeholder)"; } + $field .= " $operator $placeholder"; $placeholders = array( $placeholder => $argument, );