function facetapi_sort_weight in Facet API 6.3
Same name and namespace in other branches
- 6 facetapi.module \facetapi_sort_weight()
Sorts array items on their weight
Parameters
array item $a:
array item $b:
Return value
boolean true if lighter
8 string references to 'facetapi_sort_weight'
- current_search_settings_form_submit in contrib/
current_search/ plugins/ export_ui/ current_search_export_ui.class.php - Form submission handler for current_search_settings_form().
- FacetapiFacet::build in plugins/
facetapi/ adapter.inc - Returns the facet's render array.
- FacetapiWidget::sortFacet in plugins/
facetapi/ widget.inc - Applies selected sorting algorithms to the render array.
- facetapi_facet_display_form in ./
facetapi.admin.inc - Form constructor for the facet display settings form.
- facetapi_facet_filters_form in ./
facetapi.admin.inc - Form constructor for the facet filter settings form.
File
- ./
facetapi.module, line 1242 - An abstracted facet API that can be used by various search backends.
Code
function facetapi_sort_weight($a, $b) {
$a_weight = is_array($a) && isset($a['weight']) ? $a['weight'] : 0;
$b_weight = is_array($b) && isset($b['weight']) ? $b['weight'] : 0;
if ($a_weight == $b_weight) {
return 0;
}
return $a_weight < $b_weight ? -1 : 1;
}