You are here

public function Search::getSearchPlugin in Search API Autocomplete 8

Retrieves the search plugin.

Return value

\Drupal\search_api_autocomplete\Search\SearchPluginInterface The search's search plugin.

Throws

\Drupal\search_api_autocomplete\SearchApiAutocompleteException Thrown if the search plugin couldn't be instantiated.

Overrides SearchInterface::getSearchPlugin

1 call to Search::getSearchPlugin()
Search::getAllPlugins in src/Entity/Search.php
Retrieves all the plugins contained in this search entity.

File

src/Entity/Search.php, line 346

Class

Search
Describes the autocomplete settings for a certain search.

Namespace

Drupal\search_api_autocomplete\Entity

Code

public function getSearchPlugin() {
  if (!$this->searchPlugin) {
    $plugin_id = $this
      ->getSearchPluginId();
    $configuration = [];
    if (!empty($this->search_settings[$plugin_id])) {
      $configuration = $this->search_settings[$plugin_id];
    }
    $this->searchPlugin = \Drupal::getContainer()
      ->get('search_api_autocomplete.plugin_helper')
      ->createSearchPlugin($this, $plugin_id, $configuration);
  }
  return $this->searchPlugin;
}