You are here

public function ExtendedSearchApiQuery::build in Views Contextual Filters OR 8

Builds the necessary info to execute the query.

Parameters

view $view: The view which is executed.

Overrides SearchApiQuery::build

File

src/Plugin/views/query/ExtendedSearchApiQuery.php, line 45

Class

ExtendedSearchApiQuery
Object used to create a SELECT query.

Namespace

Drupal\views_contextual_filters_or\Plugin\views\query

Code

public function build(ViewExecutable $view) {
  if (!empty($this->where) && $this->options['contextual_filters_or']) {
    $where = [];
    foreach ($this->where as $group_id => $group) {
      if (empty($group_id) && (!empty($group['conditions']) || !empty($group['condition_groups']))) {
        $group += [
          'type' => 'OR',
        ];
        if ($group_id === '') {
          $group_id = 0;
        }
      }
      $where[$group_id] = $group;
    }
    $this->where = $where;
  }
  parent::build($view);
}