function date_views_argument_handler_simple::date_forbid in Date 8
Same name and namespace in other branches
- 7.3 date_views/includes/date_views_argument_handler_simple.inc \date_views_argument_handler_simple::date_forbid()
- 7.2 date_views/includes/date_views_argument_handler_simple.inc \date_views_argument_handler_simple::date_forbid()
Add a callback to determine if we have moved outside the valid date range for this argument.
2 calls to date_views_argument_handler_simple::date_forbid()
- date_views_argument_handler::query in date_views/
includes/ date_views_argument_handler.inc - Set up the query for this argument.
- date_views_argument_handler_simple::query in date_views/
includes/ date_views_argument_handler_simple.inc - Inject a test for valid date range before the regular query. Override the parent query to be able to control the $group.
File
- date_views/
includes/ date_views_argument_handler_simple.inc, line 329 - Date API views argument handler.
Class
- date_views_argument_handler_simple
- Date API argument handler.
Code
function date_forbid() {
if (empty($this->argument)) {
return TRUE;
}
$this->date_range = $this->date_handler
->arg_range($this->argument);
$this->min_date = $this->date_range[0];
$this->max_date = $this->date_range[1];
$this->limit = date_range_years($this->options['year_range']);
$group = !empty($this->options['date_group']) ? $this->options['date_group'] : 0;
// See if we're outside the allowed date range for our argument.
if (date_format($this->min_date, 'Y') < $this->limit[0] || date_format($this->max_date, 'Y') > $this->limit[1]) {
$this->forbid = TRUE;
$this->view->build_info['fail'] = TRUE;
return TRUE;
}
return FALSE;
}