You are here

public function date_views_argument_handler_simple::date_forbid in Date 7.2

Same name and namespace in other branches
  1. 8 date_views/includes/date_views_argument_handler_simple.inc \date_views_argument_handler_simple::date_forbid()
  2. 7.3 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
Build the query based upon the formula
date_views_argument_handler_simple::query in date_views/includes/date_views_argument_handler_simple.inc
Build the query based upon the formula

File

date_views/includes/date_views_argument_handler_simple.inc, line 369
Date API views argument handler.

Class

date_views_argument_handler_simple
Date API views argument handler.

Code

public 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;
}