You are here

function facetapi_adapter_load in Facet API 6.3

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

Instantiates the adapter plugin associated with the searcher.

Parameters

$searcher: The machine readable name of searcher.

Return value

FacetapiAdapter The adapter object, FALSE if the object can't be loaded.

11 calls to facetapi_adapter_load()
current_search_block_view in contrib/current_search/current_search.block.inc
Returns the content for a facet based on the delta.
current_search_check_visibility in contrib/current_search/current_search.block.inc
Checks whether the block should be displayed.
FacetapiAdapterTestCase::testInvalidAdapter in tests/facetapi.test
FacetapiAdapterTestCase::testSetParams in tests/facetapi.test
FacetapiTestCase::loadAdapter in tests/facetapi.test
Instantiates the adapter plugin associated with the searcher.

... See full list

File

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

Code

function facetapi_adapter_load($searcher) {
  $adapters =& ctools_static(__FUNCTION__, array());
  if (!isset($adapters[$searcher])) {
    $searcher_info = facetapi_get_searcher_info();
    if (isset($searcher_info[$searcher]['adapter'])) {
      ctools_include('plugins');
      $id = $searcher_info[$searcher]['adapter'];
      $class = ctools_plugin_load_class('facetapi', 'adapters', $id, 'handler');
      $adapters[$searcher] = $class ? new $class($searcher_info[$searcher]) : FALSE;
    }
    else {
      $adapters[$searcher] = FALSE;
    }
  }
  return $adapters[$searcher];
}