You are here

protected function OtherView::opSimple in OtherView Filter 8

Overrides InOperator::opSimple

File

src/Plugin/views/filter/OtherView.php, line 145

Class

OtherView
Filter content by other view results set.

Namespace

Drupal\other_view_filter\Plugin\views\filter

Code

protected function opSimple() {
  if (empty($this->value)) {
    return;
  }
  $this
    ->ensureMyTable();
  $results = $this
    ->getOtherViewsResults($this->value);

  // Apply filter if selected views return some results.
  if ($results) {
    $this->value = $results;
    parent::opSimple();
  }
  elseif ($this->operator === 'in') {
    $this->query
      ->addWhere($this->options['group'], 1, 2, '=');
  }
}