This option doesn't work. In the code it's checked separately each field
It should fail only if both of the fields fails.
Steps to reproduce:
Checkmark two fields under a content type's "Unique Field restrictions" in the "Choose the fields that should be unique" listing, for example "Given name" and "Family name"
For "Choose the scope for the unique values" select "Content type".
Under "Choose whether values must be unique individually or in combination" select "The combination of values from the specified fields must be unique"
Create a piece of content, "John" and "Smith" in Given and Family names.
Try to create another piece of content, "John" and "Jacob Jinglehymer"
You will get an error, "The field Given name has to be unique."
Issue fork unique_field-2914527
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 #2
matthieu_collet commentedit still doesn't work, and seems this module isn't maintened
did you fin an alternative @cslevy
Comment #3
mlncn commentedStill not working and this is arguably half of the documented functionality, not working, so i would call this major at least until the module page and internal documentation is updated to note this functionality is aspirational and not in fact implemented in current versions.
Comment #5
mlncn commentedThe code to make it work was partially there. The merge request finishes and fixes that work.
Also wanted to note that ECA module could be configured to do this and it has true entity validation now #3363212: eca_content: Provide plugins for entity validation
… and true entity validation, not form-level validation, is what i wanted and expected from Unique Field but that is not what Unique Field does. That should also be documented clearly or fixed, but i hope my contribution here is useful but i'm going to switch to ECA.
Comment #6
astonvictor commentedComment #7
_tarik_ commentedComment #8
_tarik_ commentedThe changes seem fine to me, and the code actually works as expected.
Comment #9
_tarik_ commentedSorry, just found that we have several different handlers for taxonomy, users, and nodes. Hence, these changes are unfinished
Comment #10
_tarik_ commentedI’ve added handling for the taxonomy and user entities, too. Basically, the changes are just duplicated code, but I think this is fine for now, because all 3 validation callbacks should be refactored into one function.
Comment #11
astonvictor commentedmerge conflict
Comment #13
astonvictor commented