You are here

protected function SearchApiPluginManager::alterDefinitions in Search API 8

Invokes the hook to alter the definitions if the alter hook is set.

Parameters

$definitions: The discovered plugin definitions.

Overrides DefaultPluginManager::alterDefinitions

File

src/SearchApiPluginManager.php, line 68

Class

SearchApiPluginManager
Extends the default plugin manager to add support for alter events.

Namespace

Drupal\search_api

Code

protected function alterDefinitions(&$definitions) {
  if ($this->alterHook) {
    if (!$this->alterEventName) {
      $this->moduleHandler
        ->alter($this->alterHook, $definitions);
      return;
    }
    $description = "This hook is deprecated in search_api:8.x-1.14 and is removed from search_api:2.0.0. Please use the \"{$this->alterEventName}\" event instead. See https://www.drupal.org/node/3059866";
    $this->moduleHandler
      ->alterDeprecated($description, $this->alterHook, $definitions);
  }
  if ($this->alterEventName) {
    $event = new GatheringPluginInfoEvent($definitions);
    $this->eventDispatcher
      ->dispatch($this->alterEventName, $event);
  }
}