You are here

function _relation_migrate_uid_validate in Relation 8.2

Same name and namespace in other branches
  1. 8 relation_migrate/relation_migrate.module \_relation_migrate_uid_validate()
  2. 7 relation_migrate/relation_migrate.module \_relation_migrate_uid_validate()

Validate function for UID field at configuration form. Transforms user name to UID.

1 string reference to '_relation_migrate_uid_validate'
relation_migrate_configuration_form in relation_migrate/relation_migrate.module
Configuration form callback.

File

relation_migrate/relation_migrate.module, line 88
Migrations between *reference fields and relations.

Code

function _relation_migrate_uid_validate($element, &$form_state, $form) {
  $user = user_load_by_name($form_state['values'][$element['#name']]);
  if ($user) {
    $form_state['values'][$element['#name']] = $user->uid;
  }
  else {
    form_error($element, t('User not found.'));
  }
}