You are here

function facetapi_dependencies_load in Facet API 6.3

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

Loads the dependency plugins associated with the facet.

Parameters

$facet_name: The machine readable name of the facet.

$searcher: The machine readable name of the searcher module.

Return value

array An array of FacetapiDependency objects, FALSE if no plugins.

File

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

Code

function facetapi_dependencies_load($facet_name, $searcher) {
  $dependencies = array();
  $facet = facetapi_facet_load($facet_name, $searcher);
  if ($facet && ($adapter = facetapi_adapter_load($searcher))) {
    foreach ($facet['dependency plugins'] as $id) {

      // NOTE: CTools plugin component is loaded by facetapi_adapter_load().
      $class = ctools_plugin_load_class('facetapi', 'dependencies', $id, 'handler');
      $settings = $adapter
        ->getFacet($facet)
        ->getSettings();
      $dependencies[] = new $class($id, $adapter, $facet, $settings);
    }
  }
  return $dependencies ? $dependencies : FALSE;
}