Skip to main content
1 of 4
Paul
  • 1.2k
  • 12
  • 23

D7: How to attach a single node multiple times to an entity (e.g. badges)?

For an experimental Drupal 7 site, I would like attach a single node to another entity (this might be users, other nodes or even organic groups). The reasoning is fairly simple, say I have several users active and they can gain badges for activity just like in any stackexchange platform. Each badge is represented by a single node. Now, how could a user get the same badge multiple times?

Using entityreference, I can attach the same reference multiple times, but I am struggling with the output, it will show the same badge multiple times instead of only badge name and a counter. Is there already a module for that I haven't found yet? Can you think of a better way to do it?

Badges might not be the best example as you normally wouldn't lose any. Think of a trading card game might be better, as you can have the same card multiple times and trade it with another user. So, in the end I would need a way to add and remove the references. But this will be custom code, I guess.

Paul
  • 1.2k
  • 12
  • 23