public function NcsLastUpdated::query

Same name in this branch
  1. 9.x drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastUpdated.php \Drupal\comment\Plugin\views\field\NcsLastUpdated::query()
  2. 9.x drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastUpdated.php \Drupal\comment\Plugin\views\sort\NcsLastUpdated::query()
  3. 9.x drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/filter/NcsLastUpdated.php \Drupal\comment\Plugin\views\filter\NcsLastUpdated::query()

Called to add the sort to a query.

Overrides Date::query

File

drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastUpdated.php, line 25
Definition of Drupal\comment\Plugin\views\sort\NcsLastUpdated.

Class

NcsLastUpdated
Sort handler for the newer of last comment / node updated.

Namespace

Drupal\comment\Plugin\views\sort

Code

public function query() {
  $this
    ->ensureMyTable();
  $this->node_table = $this->query
    ->ensure_table('node', $this->relationship);
  $this->field_alias = $this->query
    ->add_orderby(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->options['order'], $this->tableAlias . '_' . $this->field);
}