
| Current Path : /var/www/html/rocksensor1/web/core/modules/comment/src/Plugin/views/sort/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/modules/comment/src/Plugin/views/sort/Thread.php |
<?php
namespace Drupal\comment\Plugin\views\sort;
use Drupal\views\Attribute\ViewsSort;
use Drupal\views\Plugin\views\sort\SortPluginBase;
/**
* Sort handler for ordering by thread.
*
* @ingroup views_sort_handlers
*/
#[ViewsSort("comment_thread")]
class Thread extends SortPluginBase {
public function query() {
$this->ensureMyTable();
// See \Drupal\comment\CommentStorage::loadThread() for an explanation of
// the thinking behind this sort.
if ($this->options['order'] == 'DESC') {
$this->query->addOrderBy($this->tableAlias, $this->realField, $this->options['order']);
}
else {
$alias = $this->tableAlias . '_' . $this->realField . 'asc';
// @todo is this secure?
$this->query->addOrderBy(NULL, "SUBSTRING({$this->tableAlias}.{$this->realField}, 1, (LENGTH({$this->tableAlias}.{$this->realField}) - 1))", $this->options['order'], $alias);
}
}
}