0f9c055ec96941801cfc0875a4b1ab8b38620cd3
[yaffs-website] / web / core / modules / comment / src / Plugin / views / sort / StatisticsLastUpdated.php
1 <?php
2
3 namespace Drupal\comment\Plugin\views\sort;
4
5 use Drupal\views\Plugin\views\sort\Date;
6
7 /**
8  * Sort handler for the newer of last comment / entity updated.
9  *
10  * @ingroup views_sort_handlers
11  *
12  * @ViewsSort("comment_ces_last_updated")
13  */
14 class StatisticsLastUpdated extends Date {
15
16   public function query() {
17     $this->ensureMyTable();
18     $this->node_table = $this->query->ensureTable('node', $this->relationship);
19     $this->field_alias = $this->query->addOrderBy(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->options['order'], $this->tableAlias . '_' . $this->field);
20   }
21
22 }