class Thread in Drupal 10
Same name and namespace in other branches
- 8 core/modules/comment/src/Plugin/views/sort/Thread.php \Drupal\comment\Plugin\views\sort\Thread
- 9 core/modules/comment/src/Plugin/views/sort/Thread.php \Drupal\comment\Plugin\views\sort\Thread
Sort handler for ordering by thread.
Plugin annotation
@ViewsSort("comment_thread");
Hierarchy
- class \Drupal\views\Plugin\views\sort\SortPluginBase extends \Drupal\views\Plugin\views\HandlerBase implements CacheableDependencyInterface
- class \Drupal\comment\Plugin\views\sort\Thread
Expanded class hierarchy of Thread
Related topics
2 string references to 'Thread'
- comment.views.schema.yml in core/
modules/ comment/ config/ schema/ comment.views.schema.yml - core/modules/comment/config/schema/comment.views.schema.yml
- CommentViewsData::getViewsData in core/
modules/ comment/ src/ CommentViewsData.php
File
- core/
modules/ comment/ src/ Plugin/ views/ sort/ Thread.php, line 14
Namespace
Drupal\comment\Plugin\views\sortView source
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);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SortPluginBase:: |
public | function | Display whether or not the sort order is ascending or descending. | |
SortPluginBase:: |
public | function | ||
SortPluginBase:: |
public | function | Basic options for all sort criteria. | 2 |
SortPluginBase:: |
public | function | Determine if a sort can be exposed. | |
SortPluginBase:: |
public | function | Provide default options for exposed sorts. | |
SortPluginBase:: |
protected | function | 1 | |
SortPluginBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyInterface:: |
|
SortPluginBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyInterface:: |
|
SortPluginBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyInterface:: |
|
SortPluginBase:: |
public | function | Shortcut to display the expose/hide button. | |
SortPluginBase:: |
protected | function | Shortcut to display the value form. | |
SortPluginBase:: |
protected | function | Provide a list of options for the default sort form. | |
SortPluginBase:: |
public | function | ||
SortPluginBase:: |
protected | function | ||
SortPluginBase:: |
public | function | Simple submit handler. | |
SortPluginBase:: |
public static | function | ||
SortPluginBase:: |
public | function | Validate the options form. | |
SortPluginBase:: |
public | function | Simple validate handler. | |
Thread:: |
public | function |
Called to add the sort to a query. Overrides SortPluginBase:: |