Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / views / src / Plugin / views / argument / MonthDate.php
1 <?php
2
3 namespace Drupal\views\Plugin\views\argument;
4
5 /**
6  * Argument handler for a month (MM)
7  *
8  * @ViewsArgument("date_month")
9  */
10 class MonthDate extends Date {
11
12   /**
13    * {@inheritdoc}
14    */
15   protected $format = 'F';
16
17   /**
18    * {@inheritdoc}
19    */
20   protected $argFormat = 'm';
21
22   /**
23    * Provide a link to the next level of the view
24    */
25   public function summaryName($data) {
26     $month = str_pad($data->{$this->name_alias}, 2, '0', STR_PAD_LEFT);
27     return format_date(strtotime("2005" . $month . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
28   }
29
30   /**
31    * Provide a link to the next level of the view
32    */
33   public function title() {
34     $month = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
35     return format_date(strtotime("2005" . $month . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
36   }
37
38   public function summaryArgument($data) {
39     // Make sure the argument contains leading zeroes.
40     return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
41   }
42
43 }