protected function FacetapiWidget::sortCallback in Facet API 7.2
Same name and namespace in other branches
- 6.3 plugins/facetapi/widget.inc \FacetapiWidget::sortCallback()
- 7 plugins/facetapi/widget.inc \FacetapiWidget::sortCallback()
Applies sort information via the callback in the sort definition.
Each definition in hook_facetapi_sort_info() specifices a "callback", which is the function that returns the sorting information expected by normal uasort() callbacks.
See also
uasort()
File
- plugins/
facetapi/ widget.inc, line 319 - Base widget plugin class and helper functions for facet sorting.
Class
- FacetapiWidget
- Abstract class extended by widget plugins.
Code
protected function sortCallback(array $a, array $b) {
$return = 0;
foreach ($this->sorts as $sort) {
if ($return = $sort['callback']($a, $b)) {
if (SORT_DESC == $sort['order']) {
$return *= -1;
}
break;
}
}
return $return;
}