We should create a new UniqueFieldUserEvent event that will be dispatched when the validation for users has failed. We should pass the field name and submitted value to the event as arguments.
i.e., after adding a new error $form_state->setErrorByName()
Issue fork unique_field-3570258
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
shubham_pareek_19 commentedComment #5
boddy commentedComment #6
boddy commentedFixed merge conflicts.
Created an additional field 'field_text', set Unique Field restrictions for it in User.
Edited the existing user's field, tried to add the second one with the same value.
The UniqueFieldUserEvent event was dispatched successfully.
RTBC
Comment #7
astonvictor commentedmerge conflicts
Comment #9
astonvictor commented