You are here

function date_api_argument_handler::get_default_argument in Date 6.2

Set the empty argument value to the current date, formatted appropriately for this argument.

File

includes/date_api_argument_handler.inc, line 174
Views argument handler.

Class

date_api_argument_handler
Date API argument handler.

Code

function get_default_argument($raw = FALSE) {
  $granularity = $this->options['granularity'];
  if (!$raw && $this->options['default_argument_type'] == 'date') {
    if ($granularity == 'week') {
      $now = date_now();
      $week = date_week(date_format($now, 'Y-m-d'));
      return date_format($now, 'Y') . '-W' . $week;
    }
    else {
      return date($this
        ->format(), time());
    }
  }
  else {
    return parent::get_default_argument($raw);
  }
}