You are here

public function TextSynonymsBehavior::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 Array of synonyms extracted from $entity

Overrides SynonymsBehavior::extractSynonyms

File

synonyms_provider_field/includes/TextSynonymsBehavior.class.inc, line 13
Enables text and number field types to be source of synonyms.

Class

TextSynonymsBehavior
Definition of TextSynonymsBehavior class.

Code

public function extractSynonyms($entity, $langcode = NULL) {
  $synonyms = array();
  foreach ($this
    ->entityItems($entity, $langcode) as $item) {
    $synonyms[] = $item['value'];
  }
  return $synonyms;
}