public function NumericArgument::query in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/argument/NumericArgument.php \Drupal\views\Plugin\views\argument\NumericArgument::query()
Set up the query for this argument.
The argument sent may be found at $this->argument.
Overrides ArgumentPluginBase::query
1 method overrides NumericArgument::query()
- UidRevision::query in core/
modules/ node/ src/ Plugin/ views/ argument/ UidRevision.php - Set up the query for this argument.
File
- core/
modules/ views/ src/ Plugin/ views/ argument/ NumericArgument.php, line 99 - Contains \Drupal\views\Plugin\views\argument\NumericArgument.
Class
- NumericArgument
- Basic argument handler for arguments that are numeric. Incorporates break_phrase.
Namespace
Drupal\views\Plugin\views\argumentCode
public function query($group_by = FALSE) {
$this
->ensureMyTable();
if (!empty($this->options['break_phrase'])) {
$break = static::breakString($this->argument, TRUE);
$this->value = $break->value;
$this->operator = $break->operator;
}
else {
$this->value = array(
$this->argument,
);
}
$placeholder = $this
->placeholder();
$null_check = empty($this->options['not']) ? '' : "OR {$this->tableAlias}.{$this->realField} IS NULL";
if (count($this->value) > 1) {
$operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
$placeholder .= '[]';
$this->query
->addWhereExpression(0, "{$this->tableAlias}.{$this->realField} {$operator}({$placeholder}) {$null_check}", array(
$placeholder => $this->value,
));
}
else {
$operator = empty($this->options['not']) ? '=' : '!=';
$this->query
->addWhereExpression(0, "{$this->tableAlias}.{$this->realField} {$operator} {$placeholder} {$null_check}", array(
$placeholder => $this->argument,
));
}
}