function Ip2LongFilter::opBetween in IP address manager 8.2
Filters by operator between.
Parameters
object $field: The views field.
Overrides NumericFilter::opBetween
File
- src/
Plugin/ views/ filter/ Ip2LongFilter.php, line 23 - Contains \Drupal\ip\Plugin\views\filter\Ip2LongFilter.
Class
- Ip2LongFilter
- Filter to handle greater than/less than ip2long filters
Namespace
Drupal\ip\Plugin\views\filterCode
function opBetween($field) {
if ($this->operator == 'between') {
$this->query
->addWhere($this->options['group'], $field, array(
ip2long($this->value['min']),
ip2long($this->value['max']),
), 'BETWEEN');
}
else {
$this->query
->addWhere($this->options['group'], db_or()
->condition($field, ip2long($this->value['min']), '<=')
->condition($field, ip2long($this->value['max']), '>='));
}
}