You are here

public function Suggestion::getSuggestedKeys in Search API Autocomplete 8

Retrieves the keywords this suggestion will autocomplete to.

Return value

string|null The suggested keywords, or NULL if the suggestion should direct to a URL instead.

Overrides SuggestionInterface::getSuggestedKeys

1 call to Suggestion::getSuggestedKeys()
Suggestion::toRenderable in src/Suggestion/Suggestion.php
Returns a render array representation of the object.

File

src/Suggestion/Suggestion.php, line 112

Class

Suggestion
Provides a value object meant to be used as result of suggestions.

Namespace

Drupal\search_api_autocomplete\Suggestion

Code

public function getSuggestedKeys() {
  if ($this->url) {
    return NULL;
  }
  if ($this->suggestedKeys) {
    return $this->suggestedKeys;
  }
  return $this->suggestionPrefix . $this->userInput . $this->suggestionSuffix;
}