protected function Fraction::opBetween in Fraction 8
Same name and namespace in other branches
- 2.x src/Plugin/views/filter/Fraction.php \Drupal\fraction\Plugin\views\filter\Fraction::opBetween()
Filters by operator between.
Parameters
object $field: The views field.
Overrides NumericFilter::opBetween
File
- src/
Plugin/ views/ filter/ Fraction.php, line 45
Class
- Fraction
- Filter handler for Fraction fields.
Namespace
Drupal\fraction\Plugin\views\filterCode
protected function opBetween($field) {
if ($this->operator == 'between') {
$expression = $field . ' BETWEEN :min AND :max';
$this->query
->addWhereExpression($this->options['group'], $expression, [
':min' => $this->value['min'],
':max' => $this->value['max'],
]);
}
else {
$expression = $field . ' <= :min OR ' . $field . ' >= :max';
$this->query
->addWhereExpression($this->options['group'], $expression, [
':min' => $this->value['min'],
':max' => $this->value['max'],
]);
}
}