You are here

protected function SelectOtherFilter::opSimple in CCK Select Other 8

Overrides InOperator::opSimple

File

src/Plugin/views/filter/SelectOtherFilter.php, line 173

Class

SelectOtherFilter
Select other filter handler.

Namespace

Drupal\cck_select_other\Plugin\views\filter

Code

protected function opSimple() {
  if (empty($this->value)) {
    return;
  }
  if (in_array('other', $this->value)) {
    $this
      ->ensureMyTable();
    $values = array_diff($this->valueOptions, $this->value);
    $operator = $this->operator === 'in' ? 'not in' : 'in';
    $this->query
      ->addWhere($this->options['group'], "{$this->tableAlias}.{$this->realField}", array_values($values), $operator);
  }
  else {
    parent::opSimple();
  }
}