You are here

public function MySynonymsSynonymsBehavior::extractSynonyms in Synonyms 7

Extract synonyms from an entity within a specific behavior implementation.

Parameters

object $entity: Entity from which to extract synonyms

string $langcode: Language code for which to extract synonyms from the entity, if one is known

Return value

array Array of synonyms extracted from $entity

Overrides SynonymsBehavior::extractSynonyms

File

./synonyms.api.php, line 85
Documentation for Synonyms module.

Class

MySynonymsSynonymsBehavior
Example of synonyms behavior implementation class.

Code

public function extractSynonyms($entity, $langcode = NULL) {
  $synonyms = array();

  // Do something with $entity in order to extract synonyms from it. Add all
  // those synonyms into your $synonyms array.
  return $synonyms;
}