You are here

function views_handler_filter_node_nid_php::query in Views PHP Filter 7

Same name and namespace in other branches
  1. 6 views_handler_filter_node_nid_php.inc \views_handler_filter_node_nid_php::query()

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides views_handler_filter::query

File

./views_handler_filter_node_nid_php.inc, line 78

Class

views_handler_filter_node_nid_php

Code

function query() {
  if (($result = $this
    ->_parse_input($this->value)) === false) {
    return;
  }
  $this
    ->ensure_my_table();
  if ($this->operator == 'NAND') {
    if (!(empty($result) || count($result) == 1 && $result[0] == NULL)) {
      $this->query
        ->add_where($this->options['group'], "{$this->table_alias}.{$this->real_field} NOT IN (%s)", implode(",", $result));
    }
  }
  else {

    // $this->operator == 'AND'
    if (empty($result) || count($result) == 1 && $result[0] == NULL) {
      $this->query
        ->add_where($this->options['group'], "{$this->table_alias}.{$this->real_field} IS NULL");
    }
    else {
      $this->query
        ->add_where($this->options['group'], "{$this->table_alias}.{$this->real_field} IN (%s)", implode(",", $result));
    }
  }
}