You are here

function hook_facetapi_sort_info in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 facetapi.api.php \hook_facetapi_sort_info()
  2. 6 facetapi.api.inc \hook_facetapi_sort_info()
  3. 7 facetapi.api.php \hook_facetapi_sort_info()

Define all facets sorting algorithms provided by the module.

Sorts are applied in the FacetapiWidget::sortFacet() method which is called by FacetapiWidget::init().

Return value

array An associative array keyed by unique name of the sort. Each sort is an associative array containing:

  • 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: (optional) The default weight of the sort specifying its default processing order. Defaults to 0.

See also

FacetapiWidget::init()

FacetapiWidget::sortFacet()

1 function implements hook_facetapi_sort_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

facetapi_facetapi_sort_info in ./facetapi.facetapi.inc
Implements hook_facetapi_sort_info().
1 invocation of hook_facetapi_sort_info()
facetapi_get_sort_info in ./facetapi.module
Returns all sort definitions.

File

./facetapi.api.php, line 287
Hooks provided by the Facet API module.

Code

function hook_facetapi_sort_info() {
  $sorts = array();
  $sorts['active'] = array(
    'label' => t('Facet active'),
    'callback' => 'facetapi_sort_active',
    'description' => t('Sort by whether the facet is active or not.'),
    'weight' => -50,
  );
  return $sorts;
}