You are here

function cck_select_other_handler_filter::op_simple in CCK Select Other 7

Same name and namespace in other branches
  1. 7.2 views/cck_select_other_handler_filter.inc \cck_select_other_handler_filter::op_simple()

Overrides views_handler_filter_in_operator::op_simple

File

views/cck_select_other_handler_filter.inc, line 194

Class

cck_select_other_handler_filter
Extends Views in operator filter.

Code

function op_simple() {
  if (empty($this->value)) {
    return;
  }
  if (in_array('other', $this->value)) {

    // We need to reverse the operator and find the inverse.
    $this
      ->ensure_my_table();
    $values = array_diff($this->value_options, $this->value);
    $operator = $this->operator == 'in' ? 'not in' : 'in';
    $this->query
      ->add_where($this->options['group'], "{$this->table_alias}.{$this->real_field}", array_values($values), $operator);
  }
  else {

    // Query as normal.
    parent::op_simple();
  }
}