function uuidreference_autocomplete_value in UUID reference field 7
Value callback for autocomplete element.
1 string reference to 'uuidreference_autocomplete_value'
- uuidreference_field_widget_form in ./
uuidreference.module - Implements hook_field_widget_form().
File
- ./
uuidreference.module, line 252
Code
function uuidreference_autocomplete_value($element, $input = FALSE, $form_state) {
if ($input === FALSE) {
$uuid = $element['#default_value'];
if (!empty($uuid)) {
$field = field_info_field($element['#field_name']);
$target_type = $field['settings']['target_type'];
$ids = entity_get_id_by_uuid($target_type, array(
$uuid,
));
if (!empty($ids)) {
$entities = entity_load($target_type, $ids);
$entity = reset($entities);
$label = check_plain(entity_label($target_type, $entity));
$label .= ' [' . $uuid . ']';
return $label;
}
}
}
}