public function Numeric::__toString in Views XML Backend 8
Generates an XPath filter string.
Return value
string The XPath filter string.
Overrides XmlFilterInterface::__toString
File
- src/
Plugin/ views/ filter/ Numeric.php, line 73 - Contains \Drupal\views_xml_backend\Plugin\views\filter\Numeric.
Class
- Numeric
- Default implementation of the base filter plugin.
Namespace
Drupal\views_xml_backend\Plugin\views\filterCode
public function __toString() {
$operator = $this->operator;
$xpath = $this->options['xpath_selector'];
$min = Xpath::escapeXpathString($this->value['min']);
$max = Xpath::escapeXpathString($this->value['max']);
if ($operator === 'between') {
return $xpath . ' >= ' . $min . ' and ' . $xpath . ' <= ' . $max;
}
if ($operator === 'not between') {
return $xpath . ' <= ' . $min . ' or ' . $xpath . ' >= ' . $max;
}
return $xpath . ' ' . $operator . ' ' . Xpath::escapeXpathString($this->value['value']);
}