You are here

function facetapi_check_requirements in Facet API 7

Same name and namespace in other branches
  1. 6.3 facetapi.module \facetapi_check_requirements()
  2. 7.2 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

bool A boolean flagging whether all requirements were passed.

6 calls to facetapi_check_requirements()
FacetapiApiFunctions::testHierarchicalRequirements in tests/facetapi.test
Tests the requirements system for hierarchies.
FacetapiApiFunctions::testPropertyRequirements in tests/facetapi.test
Tests the requirements system for property equality.
FacetapiApiFunctions::testPropertySetRequirements in tests/facetapi.test
Tests the requirements system for property existence.
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.

... See full list

File

./facetapi.module, line 1021
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;
}