You are here

public function GoogleAnalyticsQuery::addOrderBy in Google Analytics Reports 8.3

Add SORT attribute to the query.

Parameters

string $table: NULL, don't use this.

string $field: The metric/dimensions/field.

string $order: Either '' for ascending or '-' for descending.

string $alias: Don't use this yet (at all?).

array $params: Don't use this yet (at all?).

File

src/Plugin/views/query/GoogleAnalyticsQuery.php, line 251

Class

GoogleAnalyticsQuery
Defines a Views query class for Google Analytics Reports API.

Namespace

Drupal\google_analytics_reports\Plugin\views\query

Code

public function addOrderBy($table, $field = NULL, $order = 'ASC', $alias = '', array $params = []) {
  $this->orderby[] = [
    'field' => $field,
    'direction' => strtoupper($order) == 'DESC' ? '-' : '',
  ];
}