You are here

public function Date::getArgument in Calendar 8

Return the default argument.

Overrides ArgumentDefaultPluginBase::getArgument

File

calendar_datetime/src/Plugin/views/argument_default/Date.php, line 74

Class

Date
The current date argument default handler.

Namespace

Drupal\calendar_datetime\Plugin\views\argument_default

Code

public function getArgument() {
  $argument = $this->argument;

  // The Date argument handlers provide their own format strings, otherwise
  // use a default.
  if ($argument instanceof Date) {

    /** @var \Drupal\views\Plugin\views\argument\Date $argument */
    $format = $argument
      ->getArgFormat();
  }
  else {
    $format = 'Y-m-d';
  }
  $request_time = $this->request->server
    ->get('REQUEST_TIME');
  return $this->dateFormatter
    ->format($request_time, 'custom', $format);
}