You are here

function facetapi_sort_active in Facet API 7

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

Sorts by whether or not a facet is active.

See also

uasort()

2 string references to 'facetapi_sort_active'
facetapi_facetapi_sort_info in ./facetapi.facetapi.inc
Implements hook_facetapi_sort_info().
hook_facetapi_sort_info in ./facetapi.api.php
Define all facets sorting algorithms provided by the module.

File

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

Code

function facetapi_sort_active(array $a, array $b) {
  $a_active = isset($a['#active']) ? $a['#active'] : 0;
  $b_active = isset($b['#active']) ? $b['#active'] : 0;
  if ($a_active == $b_active) {
    return 0;
  }
  return $a_active < $b_active ? -1 : 1;
}