Hi! I'm creating a module which defines a 'minutes' content type. This can only be attached to an event in the calendar, and should inherit a bunch of information from the parent. In my version for 4.6, I didn't worry about the taxonomy information changing in the parent (partly because I didn't think about it, partly because I was writing custom view methods, which were able to join up with the parent). However, for 4.7, I'm trying to rethink how I did a bunch of stuff, and I'd like to start using Views in place of some custom view methods.
My question is this: what is the best way to keep up to date with changes in the taxonomy of the parent event?
When the parent event is moved from one category to another, so should the minutes for the event. I see two options:
- hook_nodeapi
- the Views api
hook_nodeapi: I would implement hook_nodeapi, and whenever an event is changed, check to see if there are minutes, and if there are, update the minutes taxonomy settings. The problem here is how to handle revisioning — when the parent event has a new revision written, I should write a new revision of the minutes. How do I do this properly? And how do I handle the taxonomy stuff for non-new revisions?
The Views api: I would need to somehow add extra fields and use handlers and stuff (a lot of Views confuses me right now, because I haven't done a lot with it) so that any Views created would be able to base themselves off of the taxonomy of the parents; the minutes themselves would never have taxonomy terms attached to them. Here, the issue is that the nodes would never be categorized unless you were using Views.
Any suggestions?
Comments
Node revisions...
So, the more I think about this, the more I think that the first solution is the correct one. Also, experimentation has revealed that changes in taxonomy are not counted as revisions to the node (I'm going to file this as a bug report against Drupal), so this is actually easy to implement, as I don't have to worry about somehow tricking Drupal into creating a new revision for a node that isn't being edited.