You are here

function facetapi_sort_indexed in Facet API 6

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

Sorts by raw indexed value.

1 string reference to 'facetapi_sort_indexed'
facetapi_facetapi_sort_info in ./facetapi.module
Implementation of hook_facetapi_sort_info().

File

./facetapi.adapter.inc, line 769
Defines classes used by the FacetAPI module.

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;
}