You are here

public static function SearchApiAutocompleteSuggesterPluginBase::create in Search API Autocomplete 7

Creates a new instance of this class.

Parameters

SearchApiAutocompleteSearch $search: The search to which this suggester is attached.

array $configuration: An associative array containing the suggester's configuration, if any.

string $plugin_id: The suggester's plugin ID.

array $plugin_definition: The suggester plugin's definition.

Return value

static A new instance of this class.

Overrides SearchApiAutocompleteSuggesterInterface::create

File

src/SearchApiAutocompleteSuggesterPluginBase.php, line 47
Contains SearchApiAutocompleteSuggesterPluginBase.

Class

SearchApiAutocompleteSuggesterPluginBase
Provides a base class for suggester plugins.

Code

public static function create(SearchApiAutocompleteSearch $search, array $configuration, $plugin_id, array $plugin_definition) {

  // It seems there is no way to have "new static()"-like functionality in
  // PHP 5.2, so we have to use this workaround instead.
  $class = $plugin_definition['class'];
  return new $class($search, $configuration, $plugin_id, $plugin_definition);
}