You are here

public function CommercePriceSynonymsBehavior::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_commerce/includes/CommercePriceSynonymsBehavior.class.inc, line 13
Enables Commerce Price field type for synonyms integration.

Class

CommercePriceSynonymsBehavior
Definition of CommercePriceSynonymsBehavior class.

Code

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