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

3
namespace Views\node\Plugin\views\argument;
4 5

use Drupal\Core\Annotation\Plugin;
6
use Drupal\views\Plugin\views\argument\Date;
7 8 9

/**
 * Argument handler for a year (CCYY)
10
 *
11
 * @Plugin(
12 13
 *   id = "node_created_year",
 *   module = "node"
dawehner's avatar
dawehner committed
14
 * )
15 16
 */
class CreatedYear extends Date {
17

18 19 20 21 22 23 24 25
  /**
   * Constructor implementation
   */
  function construct() {
    parent::construct();
    $this->arg_format = 'Y';
    $this->formula = views_date_sql_extract('YEAR', "***table***.$this->real_field");
  }
26

27
}