You are here

protected function FacetSourcePluginManager::findDefinitions in Facets 8

Finds plugin definitions.

Return value

array List of definitions to store in cache.

Overrides DefaultPluginManager::findDefinitions

File

src/FacetSource/FacetSourcePluginManager.php, line 58

Class

FacetSourcePluginManager
Manages facet source plugins.

Namespace

Drupal\facets\FacetSource

Code

protected function findDefinitions() {
  $defs = parent::findDefinitions();

  // Definitions that are based on search api when search api is not enabled
  // should not exist, so make sure we do exactly that, we do this in
  // ::findDefinitions because this one is called before the result is saved.
  $defs = array_filter($defs, function ($item) {
    if ($item['id'] === 'search_api' && !$this->moduleHandler
      ->moduleExists('search_api')) {
      return FALSE;
    }
    return TRUE;
  });
  return $defs;
}