You are here

function facetapi_adapter_load in Facet API 6

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

Returns a searcher module's adapter class.

Parameters

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

$reset: A boolean flagging whether the static should be reset.

Return value

A FacetapiAdapter object, FALSE on errors.

9 calls to facetapi_adapter_load()
facetapi_apachesolr_apachesolr_prepare_query in contrib/facetapi_apachesolr/facetapi_apachesolr.module
Implementation of hook_apachesolr_prepare_query().
facetapi_apachesolr_date_range in contrib/facetapi_apachesolr/facetapi_apachesolr.module
Gets the range of dates we are using.
facetapi_block_view in ./facetapi.widget.inc
Returns data for the "view" operation of hook_block().
facetapi_enabled_facets_get in ./facetapi.module
Returns facets enabled in a given realm. If the realm name is NULL, all facets that are enabled in at least one realm will be returned.
facetapi_facet_load in ./facetapi.module
Loads a single facet definition.

... See full list

File

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

Code

function facetapi_adapter_load($searcher, $reset = FALSE) {
  static $adapters = array();

  // Due to the "load arguments" parameter defined in some menu items, we want
  // to ignore non-booleans so that the static isn't reset whenever the menu
  // system calls this function.
  if (!is_bool($reset)) {
    $reset = FALSE;
  }

  // Ensures only one instance of this class exists.
  if (!isset($adapters[$searcher]) || $reset) {
    $definitions = facetapi_adapter_info_get();
    if (isset($definitions[$searcher]) && facetapi_file_include($definitions[$searcher])) {
      $adapters[$searcher] = new $definitions[$searcher]['class']($searcher, $definitions[$searcher]['type'], $definitions[$searcher]['module']);
    }
    else {
      $adapters[$searcher] = FALSE;
    }
  }
  return $adapters[$searcher];
}