protected function SearchApiViewsHandlerArgumentDate::fillValue in Search API 7
Fills $this->value with data from the argument.
2 calls to SearchApiViewsHandlerArgumentDate::fillValue()
- SearchApiViewsHandlerArgumentDate::query in contrib/
search_api_views/ includes/ handler_argument_date.inc - Set up the query for this argument.
- SearchApiViewsHandlerArgumentDate::title in contrib/
search_api_views/ includes/ handler_argument_date.inc - Computes the title this argument will assign the view, given the argument.
File
- contrib/
search_api_views/ includes/ handler_argument_date.inc, line 86 - Contains the SearchApiViewsHandlerArgumentDate class.
Class
- SearchApiViewsHandlerArgumentDate
- Defines a contextual filter searching for a date or date range.
Code
protected function fillValue() {
if (!empty($this->options['break_phrase'])) {
// Set up defaults:
if (!isset($this->value)) {
$this->value = array();
}
if (!isset($this->operator)) {
$this->operator = 'OR';
}
if (empty($this->argument)) {
return;
}
if (preg_match('/^([-\\d;:\\s]+\\+)*[-\\d;:\\s]+$/', $this->argument)) {
// The '+' character in a query string may be parsed as ' '.
$this->value = explode('+', $this->argument);
}
elseif (preg_match('/^([-\\d;:\\s]+,)*[-\\d;:\\s]+$/', $this->argument)) {
$this->operator = 'AND';
$this->value = explode(',', $this->argument);
}
// Keep an 'error' value if invalid strings were given.
if (!empty($this->argument) && (empty($this->value) || !is_array($this->value))) {
$this->value = FALSE;
}
}
else {
$this->value = array(
$this->argument,
);
}
}