You are here

public function ViewsJsonQuery::sort in Views Json Source 8

Same name and namespace in other branches
  1. 1.x src/Plugin/views/query/ViewsJsonQuery.php \Drupal\views_json_source\Plugin\views\query\ViewsJsonQuery::sort()

Sort.

1 call to ViewsJsonQuery::sort()
ViewsJsonQuery::parse in src/Plugin/views/query/ViewsJsonQuery.php
Parse.

File

src/Plugin/views/query/ViewsJsonQuery.php, line 550

Class

ViewsJsonQuery
Base query handler for views_json_source.

Namespace

Drupal\views_json_source\Plugin\views\query

Code

public function sort(&$result, $field, $order) {
  if (strtolower($order) == 'asc') {
    usort($result, $this
      ->sortAsc($field));
  }
  else {
    usort($result, $this
      ->sortDesc($field));
  }
}