You are here

public function Field::clickSort in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/field/Field.php \Drupal\views\Plugin\views\field\Field::clickSort()

Called to determine what to tell the clicksorter.

Overrides FieldPluginBase::clickSort

File

core/modules/views/src/Plugin/views/field/Field.php, line 300
Contains \Drupal\views\Plugin\views\field\Field.

Class

Field
A field that displays entity field data.

Namespace

Drupal\views\Plugin\views\field

Code

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 (without adding the column).
    $this->aliases[$column] = $this->tableAlias . '.' . $column;
  }
  $this->query
    ->addOrderBy(NULL, NULL, $order, $this->aliases[$column]);
}