You are here

function hook_date_default_argument_alter in Date 8

Same name and namespace in other branches
  1. 7.3 date.api.php \hook_date_default_argument_alter()
  2. 7.2 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, formatted appropriately for this argument.

File

./date.api.php, line 19
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 = new DrupalDateTime();
    $value = $default_date
      ->format($argument->arg_format);
  }
}