You are here

function facetapi_adapter_load in Facet API 7

Same name and namespace in other branches
  1. 6.3 facetapi.module \facetapi_adapter_load()
  2. 6 facetapi.module \facetapi_adapter_load()
  3. 7.2 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.
FacetapiApiFunctions::testAdapterLoad in tests/facetapi.test
Tests the loading of the adapter.
FacetapiTestCase::facetapiLoadObjects in tests/facetapi.test
Returns adapter, realm, and facet objects and base admin path.
facetapi_build_realm in ./facetapi.module
Builds a facet realm.

... See full list

File

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

Code

function facetapi_adapter_load($searcher) {
  $adapters =& drupal_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];
}