You are here

function facetapi_get_sort_info in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 facetapi.module \facetapi_get_sort_info()
  2. 7 facetapi.module \facetapi_get_sort_info()

Returns all sort definitions.

Return value

array An associative array of sort definitions keyed by sort name. Each sort definition contains:

  • name: The machine readable name of the sort.
  • title: The human readable name of the sort displayed in the admin UI.
  • callback: The uasort() callback the render array is passed to.
  • description: The description of the sort displayed in the admin UI.
  • weight: The default weight of the sort specifying its processing order.
2 calls to facetapi_get_sort_info()
FacetapiWidget::sortFacet in plugins/facetapi/widget.inc
Applies sorting algorithms to the items in the facet's render array.
facetapi_get_available_sorts in ./facetapi.admin.inc
Returns the sorts available to the facet.

File

./facetapi.module, line 741
An abstracted facet API that can be used by various search backends.

Code

function facetapi_get_sort_info() {
  $sort_info =& drupal_static(__FUNCTION__);
  if (NULL === $sort_info) {
    $sort_info = module_invoke_all('facetapi_sort_info');
    foreach ($sort_info as $sort_name => $info) {
      $sort_info[$sort_name] += array(
        'name' => $sort_name,
        'label' => $sort_name,
        'callback' => '',
        'requirements' => array(),
        'description' => '',
        'weight' => 0,
      );
    }
    drupal_alter('facetapi_sort_info', $sort_info);
  }
  return $sort_info;
}