1 date_views_argument_handler_simple.inc date_views_argument_handler_simple::get_default_argument($raw = FALSE)

Set the empty argument value to the current date.

Formatted appropriately for this argument.

Overrides views_handler_argument_date::get_default_argument

File

core/modules/date/views/date_views_argument_handler_simple.inc, line 106
Date API views argument handler.

Class

date_views_argument_handler_simple

Code

function get_default_argument($raw = FALSE) {
  $is_default = FALSE;

  if (!$raw && $this->options['default_argument_type'] == 'date') {
    $granularity = $this->options['granularity'];
    if ($granularity == 'week') {
      $now = date_now();
      $week = date_week(date_format($now, 'Y-m-d'));
      $value = date_format($now, 'o') . '-W' . date_pad($week);
    }
    else {
      $value = date($this->arg_format, REQUEST_TIME);
    }
    backdrop_alter('date_default_argument', $this, $value);

    return $value;
  }

  // Let the parent argument handle options like node created date.
  return parent::get_default_argument($raw);
}