You are here

public function MonthDate::title in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/argument/MonthDate.php \Drupal\views\Plugin\views\argument\MonthDate::title()

Get the title this argument will assign the view, given the argument.

This usually needs to be overridden to provide a proper title.

Overrides ArgumentPluginBase::title

File

core/modules/views/src/Plugin/views/argument/MonthDate.php, line 38

Class

MonthDate
Argument handler for a month (MM)

Namespace

Drupal\views\Plugin\views\argument

Code

public function title() {
  $month = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
  try {
    return $this->dateFormatter
      ->format(strtotime("2005" . $month . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
  } catch (\InvalidArgumentException $e) {
    return parent::title();
  }
}