CreatedYear.php 588 Bytes
Newer Older
1 2
<?php

3 4 5 6 7
/**
 * @file
 * Definition of Views\node\Plugin\views\argument\CreatedYear.
 */

8
namespace Views\node\Plugin\views\argument;
9 10

use Drupal\Core\Annotation\Plugin;
11
use Drupal\views\Plugin\views\argument\Date;
12 13 14

/**
 * Argument handler for a year (CCYY)
15
 *
16
 * @Plugin(
17 18
 *   id = "node_created_year",
 *   module = "node"
dawehner's avatar
dawehner committed
19
 * )
20 21
 */
class CreatedYear extends Date {
22

23 24 25
  /**
   * Constructor implementation
   */
26
  public function construct() {
27 28
    parent::construct();
    $this->arg_format = 'Y';
29
    $this->formula = views_date_sql_extract('YEAR', "***table***.$this->realField");
30
  }
31

32
}