public function SuggestionManager::getSuggestions in Linkit 8.5
Gets the suggestions.
Parameters
ProfileInterface $linkitProfile: The linkit profile.
string $search_string: The string ro use in the matchers.
Return value
\Drupal\linkit\Suggestion\SuggestionCollection A suggestion collection.
File
- src/
SuggestionManager.php, line 28
Class
- SuggestionManager
- Suggestion service to handle autocomplete suggestions.
Namespace
Drupal\linkitCode
public function getSuggestions(ProfileInterface $linkitProfile, $search_string) {
$suggestions = new SuggestionCollection();
if (empty(trim($search_string))) {
return $suggestions;
}
foreach ($linkitProfile
->getMatchers() as $plugin) {
$suggestions
->addSuggestions($plugin
->execute($search_string));
}
return $suggestions;
}