function FieldPluginBase::clickSort

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::clickSort()
  2. 8.9.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::clickSort()
  3. 10 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 click sorter.

File

core/modules/views/src/Plugin/views/field/FieldPluginBase.php, line 244

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.