public static function SuggestionStorage::getSuggestion in Autocomplete Search Suggestions 3.0.x
Same name and namespace in other branches
- 8.2 src/SuggestionStorage.php \Drupal\suggestion\SuggestionStorage::getSuggestion()
- 8 src/SuggestionStorage.php \Drupal\suggestion\SuggestionStorage::getSuggestion()
Fetch the data for the suplied ngram.
Parameters
string $ngram: The requested ngram.
Return value
object An array of suggestion objects.
2 calls to SuggestionStorage::getSuggestion()
- SuggestionEditForm::buildForm in src/
Form/ SuggestionEditForm.php - The suggestion edit form.
- SuggestionHelper::updateSrc in src/
SuggestionHelper.php - Calculate the ngram's density.
File
- src/
SuggestionStorage.php, line 200
Class
- SuggestionStorage
- Database CRUD.
Namespace
Drupal\suggestionCode
public static function getSuggestion($ngram = '') {
return \Drupal::database()
->query("SELECT * FROM {suggestion} WHERE ngram = :ngram", [
':ngram' => $ngram,
])
->fetchObject();
}