function FieldPluginBase::clickSort

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::clickSort()
  2. 10 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::clickSort()
  3. 11.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::clickSort()

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 221

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.