function user_reference_field_widget_form in References 7.2
Implements hook_field_widget_form().
File
- user_reference/
user_reference.module, line 664 - Defines a field type for referencing a user from a node.
Code
function user_reference_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
switch ($instance['widget']['type']) {
case 'user_reference_autocomplete':
$element += array(
'#type' => 'textfield',
'#default_value' => isset($items[$delta]['uid']) ? $items[$delta]['uid'] : NULL,
'#autocomplete_path' => $instance['widget']['settings']['autocomplete_path'] . '/' . $instance['entity_type'] . '/' . $instance['bundle'] . '/' . $field['field_name'],
'#size' => $instance['widget']['settings']['size'],
'#element_validate' => array(
'user_reference_autocomplete_validate',
),
'#value_callback' => 'user_reference_autocomplete_value',
);
break;
}
return array(
'uid' => $element,
);
}