You are here

function facetapi_sort_count in Facet API 6.3

Same name and namespace in other branches
  1. 6 facetapi.adapter.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.facetapi.inc
Implements hook_facetapi_sort_info().

File

plugins/facetapi/widget.inc, line 269
Abstract widget plugin class.

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