You are here

function facetapi_check_requirements in Facet API 6.3

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

Checks requirements.

Requirements fail if at least one requirements callback returns FALSE. Note that if no requirement callbacks are passed, this function will return TRUE.

Parameters

array $requirements: The requirements keyed by callback to options.

array $realm: The realm definition.

array $facet: The facet definition.

Return value

A boolean flagging whether all requirements were passed.

3 calls to facetapi_check_requirements()
facetapi_get_available_sorts in ./facetapi.admin.inc
Returns the sorts available to the facet.
facetapi_get_filters in ./facetapi.module
Returns all filter definitions available to the facet.
facetapi_get_widgets in ./facetapi.admin.inc
Returns the widget plugin definitions available to the facet.

File

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

Code

function facetapi_check_requirements(array $requirements, array $realm, array $facet, $operator = 'AND') {
  $return = TRUE;
  module_load_include('inc', 'facetapi', 'facetapi.requirements');
  foreach ($requirements as $callback => $options) {
    if (!call_user_func($callback, $realm, $facet, $options, $operator)) {
      $return = FALSE;
      break;
    }
  }
  return $return;
}