You are here

function hook_facetapi_facet_info in Facet API 6

Same name and namespace in other branches
  1. 6.3 facetapi.api.php \hook_facetapi_facet_info()
  2. 7.2 facetapi.api.php \hook_facetapi_facet_info()
  3. 7 facetapi.api.php \hook_facetapi_facet_info()

Defines facets.

Facets are filters that can be used to refine a search. Although most facets are attached to a search field, some facets may be straight markup, such as one that returns to the original search query.

Parameters

$searcher: A string containing the machine readable name of the searcher module.

$type: A string containing the type of content $searcher indexes.

Return value

An associative array containing:

  • name: The machine readable name of the realm.

    • title: Human readable name of the realm, i.e. label. Defaults to "name".
    • description: The realm description.
    • field: The search field associated with the filter. Defaults to "name".
    • field alias: The variable name used in the query string as well as the name of the form element when the facet is built as a FAPI element. Defaults to "name".
    • query type: The type of query used to filter the search results when the facet is active, i.e. "range" or "wildcard", defaults to "term". Each adapter must implement hook_facetapi_query_TYPE_process() to add the facet filter to the search query. meaning that the detchDefault() method is used to retrieve the data.
    • data group: Used to describe what type of data is being faceted on. For example, taxonomy terms use "taxonomy", while user data uses "user". Some widgets rescrict which facets can use them by white listing certain data groups.
    • widget requirements: An array of requirements the facet satisfies.
    • default widgets: An array of widgets the facet attempts to find before applying the realm's global default.
    • weight: The default weight of the facet when built.
    • map callback: Callback function that maps raw values stored in the = search backend to something human readable, for example user IDs to usernames.
    • hierarchy callback: Callback function that adds perent information to the facets. For example, the facetapi_taxonomy_hierarchy_callback() function maps term IDs to their parent IDs.
    • values callabck: Callback function that returns the values for a field. This callback is useful for returning form options when facets are built as select boxes, radios, etc.
    • min callback: Callback that returns the minimum value for a field.
    • max callback: Callback that returns the maximum value for a field.
    • file: Optionally specify the file containing the callback functions.
    • file path: The path to the folder containing the file specified in "file". This defaults to the path to the module implementing the hook.
1 function implements hook_facetapi_facet_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_facet_info in ./facetapi.module
Implementation of hook_facetapi_facet_info().
1 invocation of hook_facetapi_facet_info()
facetapi_facets_get in ./facetapi.module
Invokes hook_facetapi_facet_info(), returns all defined facets.

File

./facetapi.api.inc, line 131
Defines and gives example implementations of all Facet API hooks.

Code

function hook_facetapi_facet_info($searcher, $type) {
}