You are here

function facetapi_sort_indexed in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 plugins/facetapi/widget.inc \facetapi_sort_indexed()
  2. 6 facetapi.adapter.inc \facetapi_sort_indexed()
  3. 7 plugins/facetapi/widget.inc \facetapi_sort_indexed()

Sorts by raw indexed value.

See also

uasort()

1 string reference to 'facetapi_sort_indexed'
facetapi_facetapi_sort_info in ./facetapi.facetapi.inc
Implements hook_facetapi_sort_info().

File

plugins/facetapi/widget.inc, line 366
Base widget plugin class and helper functions for facet sorting.

Code

function facetapi_sort_indexed(array $a, array $b) {
  $a_value = isset($a['#indexed_value']) ? $a['#indexed_value'] : '';
  $b_value = isset($b['#indexed_value']) ? $b['#indexed_value'] : '';
  if ($a_value == $b_value) {
    return 0;
  }
  return $a_value < $b_value ? -1 : 1;
}