Thread.php in Drupal 9
File
core/modules/comment/src/Plugin/views/sort/Thread.php
View source
<?php
namespace Drupal\comment\Plugin\views\sort;
use Drupal\views\Plugin\views\sort\SortPluginBase;
class Thread extends SortPluginBase {
public function query() {
$this
->ensureMyTable();
if ($this->options['order'] == 'DESC') {
$this->query
->addOrderBy($this->tableAlias, $this->realField, $this->options['order']);
}
else {
$alias = $this->tableAlias . '_' . $this->realField . 'asc';
$this->query
->addOrderBy(NULL, "SUBSTRING({$this->tableAlias}.{$this->realField}, 1, (LENGTH({$this->tableAlias}.{$this->realField}) - 1))", $this->options['order'], $alias);
}
}
}
Classes
Name |
Description |
Thread |
Sort handler for ordering by thread. |