interface SuggesterInterface in Search API Autocomplete 8
Represents a plugin for creating autocomplete suggestions.
Hierarchy
- interface \Drupal\search_api\Plugin\HideablePluginInterface; interface \Drupal\Component\Plugin\PluginInspectionInterface; interface \Drupal\Component\Plugin\DerivativeInspectionInterface; interface \Drupal\Component\Plugin\ConfigurableInterface; interface \Drupal\Component\Plugin\DependentPluginInterface; interface \Drupal\Core\Plugin\ContainerFactoryPluginInterface
- interface \Drupal\search_api\Plugin\ConfigurablePluginInterface
- interface \Drupal\search_api_autocomplete\Plugin\PluginInterface
- interface \Drupal\search_api_autocomplete\Suggester\SuggesterInterface
- interface \Drupal\search_api_autocomplete\Plugin\PluginInterface
- interface \Drupal\search_api\Plugin\ConfigurablePluginInterface
Expanded class hierarchy of SuggesterInterface
All classes that implement SuggesterInterface
See also
\Drupal\search_api_autocomplete\Annotation\SearchApiAutocompleteSuggester
\Drupal\search_api_autocomplete\Suggester\SuggesterManager
\Drupal\search_api_autocomplete\Suggester\SuggesterPluginBase
3 files declare their use of SuggesterInterface
- Search.php in src/
Entity/ Search.php - SearchEditForm.php in src/
Form/ SearchEditForm.php - SearchInterface.php in src/
SearchInterface.php
File
- src/
Suggester/ SuggesterInterface.php, line 17
Namespace
Drupal\search_api_autocomplete\SuggesterView source
interface SuggesterInterface extends PluginInterface {
/**
* Determines whether this plugin supports the given search.
*
* @param \Drupal\search_api_autocomplete\SearchInterface $search
* The search in question.
*
* @return bool
* TRUE if this plugin supports the given search, FALSE otherwise.
*/
public static function supportsSearch(SearchInterface $search);
/**
* Alters an autocomplete element that should use this suggester.
*
* This method is usually not needed by suggester plugins, but can be
* implemented when necessary to, for example, pass additional information to
* the autocomplete AJAX callback.
*
* @param array $element
* The render array of the autocomplete element.
*/
public function alterAutocompleteElement(array &$element);
/**
* Retrieves autocompletion suggestions for some user input.
*
* For example, when given the user input "teach us", with "us" being
* considered incomplete, \Drupal\search_api_autocomplete\SuggestionInterface
* objects representing the following suggestions might be returned:
*
* @code
* [
* [
* 'prefix' => t('Did you mean:'),
* 'user_input' => 'reach us',
* ],
* [
* 'user_input' => 'teach us',
* 'suggestion_suffix' => 'ers',
* ],
* [
* 'user_input' => 'teach us',
* 'suggestion_suffix' => ' swimming',
* ],
* ];
* @endcode
*
* @param \Drupal\search_api\Query\QueryInterface $query
* A query representing the completed user input so far.
* @param string $incomplete_key
* The start of another fulltext keyword for the search, which should be
* completed. Might be empty, in which case all user input up to now was
* considered completed. Then, additional keywords for the search could be
* suggested.
* @param string $user_input
* The complete user input for the fulltext search keywords so far.
*
* @return \Drupal\search_api_autocomplete\Suggestion\SuggestionInterface[]
* An array of autocomplete suggestions.
*/
public function getAutocompleteSuggestions(QueryInterface $query, $incomplete_key, $user_input);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigurableInterface:: |
public | function | Gets default configuration for this plugin. | 11 |
ConfigurableInterface:: |
public | function | Gets this plugin's configuration. | 12 |
ConfigurableInterface:: |
public | function | Sets the configuration for this plugin instance. | 12 |
ConfigurablePluginInterface:: |
public | function | Returns the plugin's description. | 1 |
ConfigurablePluginInterface:: |
public | function | Returns the label for use on the administration pages. | 1 |
ConfigurablePluginInterface:: |
public | function | Informs the plugin that some of its dependencies are being removed. | 1 |
ContainerFactoryPluginInterface:: |
public static | function | Creates an instance of the plugin. | 112 |
DependentPluginInterface:: |
public | function | Calculates dependencies for the configured plugin. | 19 |
DerivativeInspectionInterface:: |
public | function | Gets the base_plugin_id of the plugin instance. | 1 |
DerivativeInspectionInterface:: |
public | function | Gets the derivative_id of the plugin instance. | 1 |
HideablePluginInterface:: |
public | function | Determines whether this plugin should be hidden in the UI. | 1 |
PluginInspectionInterface:: |
public | function | Gets the definition of the plugin implementation. | 4 |
PluginInspectionInterface:: |
public | function | Gets the plugin_id of the plugin instance. | 2 |
PluginInterface:: |
public | function | Retrieves the search this plugin is configured for. | 1 |
PluginInterface:: |
public | function | Sets the search this plugin is configured for. | 1 |
SuggesterInterface:: |
public | function | Alters an autocomplete element that should use this suggester. | 1 |
SuggesterInterface:: |
public | function | Retrieves autocompletion suggestions for some user input. | 4 |
SuggesterInterface:: |
public static | function | Determines whether this plugin supports the given search. | 1 |