You are here

function facetapi_sort_count in Facet API 6

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

Sorts by facet count.

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

File

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

Code

function facetapi_sort_count(array $a, array $b) {
  $a_count = isset($a['#count']) ? $a['#count'] : 0;
  $b_count = isset($b['#count']) ? $b['#count'] : 0;
  if ($a_count == $b_count) {
    return 0;
  }
  return $a_count < $b_count ? -1 : 1;
}