protected function SearchService::getEntitySynonyms in Synonyms 8
Retrieve a list of synonyms from a given entity.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The given entity.
Return value
string[] A list of synonyms of a given entity
1 call to SearchService::getEntitySynonyms()
- SearchService::entityView in synonyms_search/
src/ SynonymsService/ Behavior/ SearchService.php - Implementation of hook_entity_view().
File
- synonyms_search/
src/ SynonymsService/ Behavior/ SearchService.php, line 184
Class
- SearchService
- Expose synonyms of referenced entities to core Search index.
Namespace
Drupal\synonyms_search\SynonymsService\BehaviorCode
protected function getEntitySynonyms(ContentEntityInterface $entity) {
$synonyms = [];
foreach ($this->behaviorService
->getSynonymConfigEntities(self::BEHAVIOR, $entity
->getEntityTypeId(), $entity
->bundle()) as $synonym_config) {
$synonyms = array_merge($synonyms, $synonym_config
->getProviderPluginInstance()
->getSynonyms($entity));
}
return $synonyms;
}