You are here

function facetapi_get_filters in Facet API 7

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

Returns all filter definitions available to the facet.

Each filter plugin must pass all the requirements checks specified in its definition. Only plugins that pass all requirements are returned.

Parameters

array $facet: The facet definition as returned by facetapi_facet_load().

Return value

array An associative array of filter plugin definitions keyed by the plugin ID. Each filter plugin definition contains:

  • handler: An associative array containing:

    • label: The human readable name of the plugin displayed in the admin UI.
    • description: The description of the plugin displayed in the admin UI.
    • class: The class containing the plugin.
1 call to facetapi_get_filters()
facetapi_filters_load in ./facetapi.module
Returns array of filter options available to the facet.

File

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

Code

function facetapi_get_filters(array $facet) {
  $plugins = array();

  // Iterates over all defined plugins.
  foreach (ctools_get_plugins('facetapi', 'filters') as $id => $plugin) {
    $plugin['handler'] += array(
      'label' => $id,
      'description' => '',
      'requirements' => array(),
    );

    // Checks requirements.
    if (facetapi_check_requirements($plugin['handler']['requirements'], array(), $facet)) {
      $plugins[$id] = $plugin;
    }
  }
  return $plugins;
}