You are here

function hook_date_default_argument_alter in Date 7.2

Same name and namespace in other branches
  1. 8 date.api.php \hook_date_default_argument_alter()
  2. 7.3 date.api.php \hook_date_default_argument_alter()

Alter the default value for a date argument.

Parameters

object $argument: The argument object.

string $value: The default value created by the argument handler.

1 invocation of hook_date_default_argument_alter()
date_views_argument_handler_simple::get_default_argument in date_views/includes/date_views_argument_handler_simple.inc
Set the empty argument value to the current date.

File

./date.api.php, line 16
Hooks provided by the Date module.

Code

function hook_date_default_argument_alter(&$argument, &$value) {
  $style_options = $style_options = $argument->view->display_handler
    ->get_option('style_options');
  if (!empty($style_options['track_date'])) {
    $default_date = date_now();
    $value = $default_date
      ->format($argument->arg_format);
  }
}