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."

Command icon 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

cslevy created an issue. See original summary.

matthieu_collet’s picture

it still doesn't work, and seems this module isn't maintened

did you fin an alternative @cslevy

mlncn’s picture

Priority: Normal » Major
Issue summary: View changes

Still 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.

mlncn’s picture

Status: Active » Needs review

The 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.

astonvictor’s picture

Issue tags: +LutskGCW26
_tarik_’s picture

Assigned: Unassigned » _tarik_
_tarik_’s picture

Assigned: _tarik_ » Unassigned
Status: Needs review » Reviewed & tested by the community

The changes seem fine to me, and the code actually works as expected.

_tarik_’s picture

Assigned: Unassigned » _tarik_
Status: Reviewed & tested by the community » Needs work

Sorry, just found that we have several different handlers for taxonomy, users, and nodes. Hence, these changes are unfinished

_tarik_’s picture

Assigned: _tarik_ » Unassigned
Status: Needs work » Needs review

I’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.

astonvictor’s picture

Status: Needs review » Needs work

merge conflict

  • astonvictor committed 61c52ff6 on 8.x-2.x authored by mlncn
    Issue #2914527 by mlncn: Fix check for combination of values must be...
astonvictor’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.