function realname_field_widget_form_alter in Real Name 7
Implements hook_widget_form_alter().
Overrides entityreference autocomplete fields that point to an entity of type 'user'.
File
- ./
realname.module, line 484 - Provides token-based name displays for users.
Code
function realname_field_widget_form_alter(&$element, &$form_state, $context) {
if ($context['field']['type'] == 'entityreference') {
if ($context['field']['settings']['target_type'] == 'user') {
$element['target_id']['#autocomplete_path'] = 'realname/autocomplete/' . $context['field']['field_name'] . '/' . $context['instance']['entity_type'] . '/' . $context['instance']['bundle'];
}
}
}