Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / views / src / Plugin / views / argument / DayDate.php
1 <?php
2
3 namespace Drupal\views\Plugin\views\argument;
4
5 /**
6  * Argument handler for a day (DD)
7  *
8  * @ViewsArgument("date_day")
9  */
10 class DayDate extends Date {
11
12   /**
13    * {@inheritdoc}
14    */
15   protected $format = 'j';
16
17   /**
18    * {@inheritdoc}
19    */
20   protected $argFormat = 'd';
21
22   /**
23    * Provide a link to the next level of the view
24    */
25   public function summaryName($data) {
26     $day = str_pad($data->{$this->name_alias}, 2, '0', STR_PAD_LEFT);
27     // strtotime respects server timezone, so we need to set the time fixed as utc time
28     return format_date(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
29   }
30
31   /**
32    * Provide a link to the next level of the view
33    */
34   public function title() {
35     $day = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
36     return format_date(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
37   }
38
39   public function summaryArgument($data) {
40     // Make sure the argument contains leading zeroes.
41     return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
42   }
43
44 }