public function SynonymsFieldItemList::getValue in Synonyms 8
Gets the data value.
Return value
mixed The data value.
Overrides ItemList::getValue
File
- src/
Plugin/ SynonymsFieldItemList.php, line 15
Class
- SynonymsFieldItemList
- Field item list of "synonyms" computed base field.
Namespace
Drupal\synonyms\PluginCode
public function getValue($include_computed = FALSE) {
$synonyms = [];
$entity = $this
->getEntity();
$behavior_service = \Drupal::getContainer()
->get('synonyms.behaviors');
$services = $behavior_service
->getBehaviorServices();
foreach ($services as $service_id => $service) {
foreach ($behavior_service
->getSynonymConfigEntities($service_id, $entity
->getEntityTypeId(), $entity
->bundle()) as $synonym_config) {
$synonyms = array_merge($synonyms, $synonym_config
->getProviderPluginInstance()
->getSynonyms($entity));
}
}
return array_unique($synonyms);
}