protected function FacetapiWidget::sortCallback in Facet API 6.3
Same name and namespace in other branches
- 7.2 plugins/facetapi/widget.inc \FacetapiWidget::sortCallback()
- 7 plugins/facetapi/widget.inc \FacetapiWidget::sortCallback()
Generic sort callback, useful as a callback to uasort().
Applies sorts in the order they are specified in the settings.
File
- plugins/
facetapi/ widget.inc, line 240 - Abstract widget plugin class.
Class
- FacetapiWidget
- Base class for 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;
}