You are here

function facetapi_dependencies_load in Facet API 7

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

Loads the dependency plugins associated with the facet.

Parameters

string $facet_name: The machine readable name of the facet.

string $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 419
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;
}