The structure I need to realize:
- A node references multiple taxonomy terms of type person.
- A person plays one specific role per node.
- This role is different from this taxonomy terms role on a different node.
- A taxonomy term doesn't have to specifiy a role, so the role can be empty too.
An example to describe the desired behavior a bit better:
- A movie contains taxonomy terms as actors.
- An actor has the role 'Magneto' on node A and the role 'Gandalf' on node B.
Possible way of realization I can think of right now:
- Add a custom table nid_tid_role_mapping to the drupal database with the following fields: nid, tid, role_name
- Hook into node_presave and get all the actor taxonomy terms.
- Only get the ones of the following format "Actor Name (Role)" (f.e. "Ian McKellen (Magneto)")
- Add nid, tid and role to the table nid_tid_role_mapping
- After adding role, nid and tid, rename the taxonomy term back to "Actor Name".
- Add a special table to the node edit form, which lists the term name/role mapping of this node.
My approach seems like a little overkill to me. Is there a module which could help me with this? I wasn't able to find anything...