You are here

public static function SuggestionStorage::getKeywords in Autocomplete Search Suggestions 8.2

Same name and namespace in other branches
  1. 8 src/SuggestionStorage.php \Drupal\suggestion\SuggestionStorage::getKeywords()
  2. 3.0.x src/SuggestionStorage.php \Drupal\suggestion\SuggestionStorage::getKeywords()

Fetch an array of priority suggestions.

Parameters

string $language: The language code.

Return value

array An array of suggestions.

1 call to SuggestionStorage::getKeywords()
SuggestionAdminForm::getKeywords in src/Form/SuggestionAdminForm.php
Build a list of priority suggestions.

File

src/SuggestionStorage.php, line 145

Class

SuggestionStorage
Database CRUD.

Namespace

Drupal\suggestion

Code

public static function getKeywords($language) {
  return \Drupal::database()
    ->query("SELECT ngram FROM {suggestion} WHERE src & :src AND langcode = :langcode ORDER BY ngram ASC", [
    ':src' => self::PRIORITY_BIT,
    ':langcode' => $language,
  ])
    ->fetchCol();
}