function synonyms_get_raw in Synonyms 7
Retrieve list of raw synonyms of an entity.
Parameters
$entity object: Fully loaded entity
Return value
array List of raw synonyms of an entity
1 call to synonyms_get_raw()
- synonyms_get_sanitized in ./
synonyms.module - Retrieve list of sanitized synonyms of an entity.
1 string reference to 'synonyms_get_raw'
- synonyms_entity_property_info in ./
synonyms.module - Implements hook_entity_property_info().
File
- ./
synonyms.module, line 697 - Provide synonyms feature for Drupal entities.
Code
function synonyms_get_raw($entity, array $options, $name, $entity_type, &$context) {
$synonyms = array();
$bundle = entity_extract_ids($entity_type, $entity);
$bundle = $bundle[2];
$langcode = NULL;
if (isset($options['language']) && $options['language']) {
$langcode = $options['language']->language;
}
$behavior_implementations = synonyms_behavior_get_all_enabled($entity_type, $bundle);
$providers = array();
foreach ($behavior_implementations as $implementation) {
if (!in_array($implementation['provider'], $providers)) {
$synonyms = array_merge($synonyms, $implementation['object']
->extractSynonyms($entity, $langcode));
$providers[] = $implementation['provider'];
}
}
return $synonyms;
}