You are here

public function PluginHelper::createSuggesterPlugin in Search API Autocomplete 8

Creates a suggester plugin object for the given search.

Parameters

\Drupal\search_api_autocomplete\SearchInterface $search: The search for which to create the plugin.

string $plugin_id: The plugin's ID.

array $configuration: (optional) The configuration to set for the plugin.

Return value

\Drupal\search_api_autocomplete\Suggester\SuggesterInterface The new suggester plugin object.

Throws

\Drupal\search_api_autocomplete\SearchApiAutocompleteException Thrown if an unknown plugin ID is given.

Overrides PluginHelperInterface::createSuggesterPlugin

File

src/Utility/PluginHelper.php, line 129

Class

PluginHelper
Provides methods for creating autocomplete search plugins.

Namespace

Drupal\search_api_autocomplete\Utility

Code

public function createSuggesterPlugin(SearchInterface $search, $plugin_id, array $configuration = []) {
  return $this
    ->createPlugin($search, 'suggester', $plugin_id, $configuration);
}