function facetapi_sort_weight in Facet API 6
Same name and namespace in other branches
- 6.3 facetapi.module \facetapi_sort_weight()
Useful as a uasort() callback to sort structured arrays by weight. Loose backport of the D7 drupal_sort_weight() function.
@todo Remove in favor of drupal_sort_weight() in D7.
6 string references to 'facetapi_sort_weight'
- facetapi_facets_get in ./
facetapi.module - Invokes hook_facetapi_facet_info(), returns all defined facets.
- facetapi_facets_sort in ./
facetapi.module - Adds weights to each facet, sorts the facet list.
- facetapi_facet_settings_form in ./
facetapi.admin.inc - Returns settings for an individual facet that apply to a realm.
- facetapi_facet_sorts_get in ./
facetapi.module - Returns sorts enabled for a facet in a realm. Sort definitions are returned in the order specified in the configurations settings.
- facetapi_realms_get in ./
facetapi.module - Invokes hook_facetapi_realm_info(), returns realm definitions.
File
- ./
facetapi.module, line 1008 - An abstracted facet API that can be used by various search backens.
Code
function facetapi_sort_weight(array $a, array $b) {
$a_weight = isset($a['weight']) ? $a['weight'] : 0;
$b_weight = isset($b['weight']) ? $b['weight'] : 0;
if ($a_weight == $b_weight) {
return 0;
}
return $a_weight < $b_weight ? -1 : 1;
}