You are here

public function PluginHelper::createSearchPlugin in Search API Autocomplete 8

Creates a search 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\Search\SearchPluginInterface The new search plugin object.

Throws

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

Overrides PluginHelperInterface::createSearchPlugin

File

src/Utility/PluginHelper.php, line 136

Class

PluginHelper
Provides methods for creating autocomplete search plugins.

Namespace

Drupal\search_api_autocomplete\Utility

Code

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