41 lines
782 B
PHP
41 lines
782 B
PHP
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Definition of Views\node\Plugin\views\argument\CreatedWeek.
|
|
*/
|
|
|
|
namespace Views\node\Plugin\views\argument;
|
|
|
|
use Drupal\Core\Annotation\Plugin;
|
|
use Drupal\views\Plugin\views\argument\Date;
|
|
|
|
/**
|
|
* Argument handler for a week.
|
|
*
|
|
* @Plugin(
|
|
* id = "node_created_week",
|
|
* module = "node"
|
|
* )
|
|
*/
|
|
class CreatedWeek extends Date {
|
|
|
|
/**
|
|
* Constructor implementation
|
|
*/
|
|
public function construct() {
|
|
parent::construct();
|
|
$this->arg_format = 'w';
|
|
$this->formula = views_date_sql_extract('WEEK', "***table***.$this->real_field");
|
|
}
|
|
|
|
/**
|
|
* Provide a link to the next level of the view
|
|
*/
|
|
function summary_name($data) {
|
|
$created = $data->{$this->name_alias};
|
|
return t('Week @week', array('@week' => $created));
|
|
}
|
|
|
|
}
|