2

I have a entity-reference field that enables multiple-references (cardinality is set to -1). The problem is that it allows multiple 'same' references => it is possible to save two references to one specific node.

I know I can limit that using my own validation function but I have this feeling that there has to be easier way (e.g. some settings that I don't know about).

If there's none then sorry for useless question.

2 Answers 2

2

I don't think the Entity Reference module ships with this feature. But the entityreference unique module should be sufficient for your need. It is in alpha mode, so I would check the issue queue to see if there are any security/critical issues with it before using it on a production env.

1
  • I'll look how they handle it and implement it my way probably. Anyway, thanks.
    – Petrroll
    Apr 4, 2014 at 20:06
0

Looking at entityreference unique module (thanks awm) I discovered that the best way to implement it is using entityreference behavior plugin, to be more specific its validate function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.