public function FieldPluginBase::clickSort in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::clickSort()
Adds an ORDER BY clause to the query for click sort columns.
Parameters
string $order: Either ASC or DESC
Overrides FieldHandlerInterface::clickSort
1 method overrides FieldPluginBase::clickSort()
- EntityField::clickSort in core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php - Called to determine what to tell the clicksorter.
File
- core/
modules/ views/ src/ Plugin/ views/ field/ FieldPluginBase.php, line 218
Class
- FieldPluginBase
- Base class for views fields.
Namespace
Drupal\views\Plugin\views\fieldCode
public function clickSort($order) {
if (isset($this->field_alias)) {
// Since fields should always have themselves already added, just
// add a sort on the field.
$params = $this->options['group_type'] != 'group' ? [
'function' => $this->options['group_type'],
] : [];
$this->query
->addOrderBy(NULL, NULL, $order, $this->field_alias, $params);
}
}