You are here

public function ViewsJsonQuery::sortAsc 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::sortAsc()

Sort Ascending.

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

File

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

Class

ViewsJsonQuery
Base query handler for views_json_source.

Namespace

Drupal\views_json_source\Plugin\views\query

Code

public function sortAsc($key) {
  return function ($a, $b) use ($key) {
    $a_value = $a[$key] ?? '';
    $b_value = $b[$key] ?? '';
    return strnatcasecmp($a_value, $b_value);
  };
}