You are here

protected function FacetapiFacet::_sortCallback in Facet API 6

Callback for uasort() that applies each sort in the order specified in the admin interface.

File

./facetapi.adapter.inc, line 649
Defines classes used by the FacetAPI module.

Class

FacetapiFacet
Stores facet data, provides methods that build the facet's render array.

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;
}