You are here

public function views_contextual_filters_or_search_api_query::build in Views Contextual Filters OR 7

Builds the necessary info to execute the query.

Overrides SearchApiViewsQuery::build

File

plugins/views_contextual_filters_or_search_api_query.inc, line 41
Defines the alter query object.

Class

views_contextual_filters_or_search_api_query
Object used to create a SELECT query.

Code

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