You are here

function facetapi_facets_sort in Facet API 6

Adds weights to each facet, sorts the facet list.

Parameters

&$facets: A reference to the array of facets being sorted.

$searcher: A string containing the machine readable name of the searcher module.

$realm_name: A string containing the machine readable name of the realm.

2 calls to facetapi_facets_sort()
facetapi_admin_settings_form in ./facetapi.admin.inc
Administrative settings for Search Lucene Facets.
facetapi_enabled_facets_get in ./facetapi.module
Returns facets enabled in a given realm. If the realm name is NULL, all facets that are enabled in at least one realm will be returned.

File

./facetapi.module, line 995
An abstracted facet API that can be used by various search backens.

Code

function facetapi_facets_sort(array &$facets, $searcher, $realm_name) {
  foreach ($facets as $facet_name => &$facet) {
    $facet['weight'] = (int) facetapi_setting_get('facet_weight', $searcher, $realm_name, $facet_name);
  }
  uasort($facets, 'facetapi_sort_weight');
}