function views_handler_argument_many_to_one::query

Overrides views_handler_argument::query

File

handlers/views_handler_argument_many_to_one.inc, line 108

Class

views_handler_argument_many_to_one
Argument handler for fields that have many-to-one table relationships.

Code

public function query($group_by = FALSE) {
    $empty = FALSE;
    if (isset($this->definition['zero is null']) && $this->definition['zero is null']) {
        if (empty($this->argument)) {
            $empty = TRUE;
        }
    }
    else {
        if (!isset($this->argument)) {
            $empty = TRUE;
        }
    }
    if ($empty) {
        parent::ensure_my_table();
        $this->query
            ->add_where(0, "{$this->table_alias}.{$this->real_field}", NULL, 'IS NULL');
        return;
    }
    if (!empty($this->options['break_phrase'])) {
        views_break_phrase($this->argument, $this);
    }
    else {
        $this->value = array(
            $this->argument,
        );
        $this->operator = 'or';
    }
    $this->helper
        ->add_filter();
}