You are here

public function Synonym::getSynonymsFormatted in Search API Synonym 8

Gets the synonyms formatted.

Format the comma separated synonyms string with extra spaces.

Return value

string The synonyms to the word.

Overrides SynonymInterface::getSynonymsFormatted

File

src/Entity/Synonym.php, line 102

Class

Synonym
Defines the Synonym entity.

Namespace

Drupal\search_api_synonym\Entity

Code

public function getSynonymsFormatted() {
  $synonyms = $this
    ->get('synonyms')->value;
  $synonyms = str_replace(',', ', ', $synonyms);
  return trim($synonyms);
}