I have a single parent node that has several child nodes (the children have single value nodereference fields that refer to the parent and the parent has a nodereferrer field that lists all the children). The parent and all the children are different content types. So a parent of content type1 will have one child each of content type 2, content type 3, and content type 4. The workflow is a simple DRAFT-SUBMITTED-APPROVED workflow that applies to all content types.
What I'm trying to figure out is how to best enforce that the parent node cannot move to the next workflow state until ALL the children have been moved to the next state first. For example, the parent cannot move to SUBMITTED until all children are in the SUBMITTED state.
I'm thinking it will end up being a rule, but any ideas or suggestions on how to best implement this would be greatly appreciated.
Comments
Comment #1
Bastlynn commentedA rule might work for this, or a custom module that hooks into workflow transitions. But this just isn't a feature built into the current version of Workflow.
Since this request is over a year old, I'm going to assume a solution was found or you've moved on. If not, please get updated to the latest versions of all modules and make a request for it against Drupal 7 if the problem is still there and I'll be glad to take a look at it.
Comment #2
WorldFallz commentedFor d6 I ended using rules, but it can get quite complicated with lots of rules. I have it on my radar to figure this out properly for d7 and entityreference-- either as a setting or submodule for this module, or a separate contrib. Any thought you have about the best way to approach it would be greatly appreciated.
Comment #3
nancydruWell, there is not an entityreferer module yet (#1939620: Entityreference referer module)
Check Corresponding Entity Reference.
Comment #4
nancydruHmm. I've just been updating the available hooks, and I think the new
hook_workflow('transition choice', ...)might allow you do do this. It could scan through all the children and disallow the parent transition from being shown to the user. {See #1997242: ask other modules for permission in node forms}Comment #5
johnvYou can still use Rules, but as of 7.x-1.2, we now have the new hook_workflow('transition permitted', ...) , NancyDru was mentioning.
You can use that to exclude some state transitions.
See also #2144747: [META] Flexible transitions for more requests.