function hook_facetapi_sort_info in Facet API 7
Same name and namespace in other branches
- 6.3 facetapi.api.php \hook_facetapi_sort_info()
- 6 facetapi.api.inc \hook_facetapi_sort_info()
- 7.2 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.
- requirements: An array of requirements that must pass in order for this sort to be displayed. Requirements are associative arrays keyed by function to requirement options. Optional.
- weight: (optional) The default weight of the sort specifying its default processing order. Defaults to 0.
See also
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 290 - 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',
// @see: facetapi_get_available_sorts().
'requirements' => array(
'facetapi_sort_active_requirements' => TRUE,
),
'description' => t('Sort by whether the facet is active or not.'),
'weight' => -50,
);
return $sorts;
}