You are here

public function SuggestionManager::addUnscathedSuggestion in Linkit 8.5

Adds an unscathed suggestion to the given suggestion collection.

Parameters

\Drupal\linkit\Suggestion\SuggestionCollection $suggestionCollection: A suggestion collection to add the unscathed suggestion to.

string $search_string: The string ro use in the matchers.

Return value

\Drupal\linkit\Suggestion\SuggestionCollection A suggestion collection.

File

src/SuggestionManager.php, line 53

Class

SuggestionManager
Suggestion service to handle autocomplete suggestions.

Namespace

Drupal\linkit

Code

public function addUnscathedSuggestion(SuggestionCollection $suggestionCollection, $search_string) {
  $suggestion = new DescriptionSuggestion();
  $suggestion
    ->setLabel(Html::escape($search_string))
    ->setGroup($this
    ->t('No results'))
    ->setDescription($this
    ->t('No content suggestions found. This URL will be used as is.'))
    ->setPath($search_string);
  $suggestionCollection
    ->addSuggestion($suggestion);
  return $suggestionCollection;
}