You are here

public function WebformSubmissionFieldNumeric::clickSort in Webform Views Integration 8.5

Adds an ORDER BY clause to the query for click sort columns.

Parameters

string $order: Either ASC or DESC

Overrides FieldPluginBase::clickSort

File

src/Plugin/views/field/WebformSubmissionFieldNumeric.php, line 19

Class

WebformSubmissionFieldNumeric
Webform submission numeric field.

Namespace

Drupal\webform_views\Plugin\views\field

Code

public function clickSort($order) {
  $this
    ->ensureMyTable();
  $field = $this->query
    ->addField(NULL, $this
    ->castToDataType($this->tableAlias . '.' . $this->realField), $this->realField . '_sort');
  $params = $this->options['group_type'] != 'group' ? [
    'function' => $this->options['group_type'],
  ] : [];
  $this->query
    ->addOrderBy(NULL, NULL, $order, $field, $params);
}