You are here

public function AbstractPropertySynonymsBehavior::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_property/includes/AbstractPropertySynonymsBehavior.class.inc, line 34
Abstract class for enabling entity properties to be source of synonyms.

Class

AbstractPropertySynonymsBehavior
Definition of AbstractPropertySynonymsBehavior class.

Code

public function extractSynonyms($entity, $langcode = NULL) {
  $synonyms = array();
  if (isset($entity->{$this->property}) && $entity->{$this->property}) {
    $synonyms[] = $entity->{$this->property};
  }
  return $synonyms;
}