fb2bc4abcb244e984d5b0fe071edc1f294bd574a
[yaffs-website] / web / core / modules / datetime / src / Plugin / views / argument / Date.php
1 <?php
2
3 namespace Drupal\datetime\Plugin\views\Argument;
4
5 use Drupal\views\Plugin\views\argument\Date as NumericDate;
6
7 /**
8  * Abstract argument handler for dates.
9  *
10  * Adds an option to set a default argument based on the current date.
11  *
12  * Definitions terms:
13  * - many to one: If true, the "many to one" helper will be used.
14  * - invalid input: A string to give to the user for obviously invalid input.
15  *                  This is deprecated in favor of argument validators.
16  *
17  * @see \Drupal\views\ManyTonOneHelper
18  *
19  * @ingroup views_argument_handlers
20  *
21  * @ViewsArgument("datetime")
22  */
23 class Date extends NumericDate {
24
25   /**
26    * {@inheritdoc}
27    */
28   public function getDateField() {
29     // Return the real field, since it is already in string format.
30     return "$this->tableAlias.$this->realField";
31   }
32
33   /**
34    * {@inheritdoc}
35    */
36   public function getDateFormat($format) {
37     // Pass in the string-field option.
38     return $this->query->getDateFormat($this->getDateField(), $format, TRUE);
39   }
40
41 }