function EntityField::clickSort
Same name in other branches
- 8.9.x core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::clickSort()
- 10 core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::clickSort()
- 11.x core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::clickSort()
Called to determine what to tell the clicksorter.
Overrides FieldPluginBase::clickSort
1 method overrides EntityField::clickSort()
- ModerationStateField::clickSort in core/
modules/ content_moderation/ src/ Plugin/ views/ field/ ModerationStateField.php - Called to determine what to tell the clicksorter.
File
-
core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php, line 313
Class
- EntityField
- A field that displays entity field data.
Namespace
Drupal\views\Plugin\views\fieldCode
public function clickSort($order) {
// No column selected, can't continue.
if (empty($this->options['click_sort_column'])) {
return;
}
$this->ensureMyTable();
$field_storage_definition = $this->getFieldStorageDefinition();
$column = $this->getTableMapping()
->getFieldColumnName($field_storage_definition, $this->options['click_sort_column']);
if (!isset($this->aliases[$column])) {
// Column is not in query; add a sort on it.
$this->aliases[$column] = $this->tableAlias . '.' . $column;
// If the query uses DISTINCT we need to add the column too.
if (!empty($this->view
->getQuery()->options['distinct'])) {
$this->query
->addField($this->tableAlias, $column);
}
}
$this->query
->addOrderBy(NULL, NULL, $order, $this->aliases[$column]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.