protected function YamlFormEntityReferenceTrait::getTargetEntityIds in YAML Form 8
Get target entity ids from entity autocomplete element's value.
Parameters
array|string|int $value: Entity autocomplete element's value.
Return value
array An array of entity ids.
2 calls to YamlFormEntityReferenceTrait::getTargetEntityIds()
- EntityAutocomplete::setDefaultValue in src/
Plugin/ YamlFormElement/ EntityAutocomplete.php - Set an element's default value using saved data.
- YamlFormEntityReferenceTrait::getTargetEntities in src/
Plugin/ YamlFormElement/ YamlFormEntityReferenceTrait.php - Get referenced entities.
File
- src/
Plugin/ YamlFormElement/ YamlFormEntityReferenceTrait.php, line 216
Class
- YamlFormEntityReferenceTrait
- Provides an 'entity_reference' trait.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
protected function getTargetEntityIds($value) {
if (is_array($value)) {
return array_combine($value, $value);
}
else {
return [
$value => $value,
];
}
}