function entityreference_prepopulate_field_default_value in Entityreference prepopulate 7
Field default value callback.
Set the default from the URL context. This works even if the widget is not shown, e.g. due to restricted field access.
@todo Check field cardinality.
2 string references to 'entityreference_prepopulate_field_default_value'
File
- ./
entityreference_prepopulate.module, line 187 - Prepopulate entity reference values from URL.
Code
function entityreference_prepopulate_field_default_value($entity_type, $entity, $field, $instance, $langcode) {
$items = array();
if ($ids = entityreference_prepopulate_get_values($field, $instance)) {
$items = array();
foreach ($ids as $id) {
$items[] = array(
'target_id' => $id,
);
}
}
return $items;
}