Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There's a hook_workflow($op = 'pre') that allows modules to object to state changes. The workflow tab does not call this hook, it determines the target states based on transitions and roles.
I can provide a patch if desired.
Comment | File | Size | Author |
---|---|---|---|
#9 | 155547.patch | 1.19 KB | NancyDru |
Comments
Comment #1
traxer CreditAttribution: traxer commentedIt's actually hook_workflow($op = 'transition pre').
Comment #2
Bastlynn CreditAttribution: Bastlynn commentedHi,
With the release of Drupal 7, Drupal 5 is no longer receiving security updates, reviews, or development from many contributed modules. Since 5 is now considered a depreciated version, you really should seriously look into upgrading to Drupal 6 or 7. The newer versions of Drupal work better, have more support, and will be safer (literally! security patches!) for your website. We are currently working on a new release for Workflow to Drupal 7. In light of that, further support for Drupal 5 issues is infeasible at the moment. Please consider upgrading to Drupal 6 or 7 in the near future - you'll be glad you did.
- Bastlynn
Comment #3
traxer CreditAttribution: traxer commentedDon't you want the feature in the next release?
Comment #4
Bastlynn CreditAttribution: Bastlynn commentedYep, but I needed to cut the issue queue down to size first. All the stuff closed in the first review of the issue queue will get looked at eventually but under the rules of triage I had to prioritize. Thankfully, having a pulse attached to the ticket bumps it up the priority list quite a lot. :)
Thanks for re-upping this one, I'll take a look at it.
Comment #5
Bastlynn CreditAttribution: Bastlynn commentedIf you have a patch that will let me get to this issue much more quickly.
Comment #6
Bastlynn CreditAttribution: Bastlynn commentedTaking a closer look at this, I don't think that this hook does quite what you think it does. It's designed to check just before executing a transition if there are settings that need to be changed, not to provide a list of available transitions from the state the node is in. The current way of gathering that information is correct. The hook is being called during submission from the tab form as a part of the node transition, so no further work needs to be done on this.
Comment #7
jdwfly CreditAttribution: jdwfly commentedI thought hook_workflow was designed to allow even more customization and flexibility. I am using it to further restrict who can transition than just by role. If this hook is not being called on the workflow tab then I would label this as a bug.
This comes straight from workflow.module (6.x I know, but it is what I am using).
That is exactly how I am using the 'transition pre' $op. I went ahead and did a little more digging and found this code in workflow.pages.inc
So as far as I can tell it is not calling the hook at all. This then allows for users in my case to bypass the extra authorization code I wrote in my custom module by just simply using the workflow tab. All that really needs to be done is to invoke the hook and if it returns false then it needs to exit without transitioning the node. Simple fix in my opinion and I'd get a patch up there but I am using 6.x so I am not sure how different it would be.
Comment #8
NancyDruThis code seems to do what jdwfly wants. If the workflow is very complex or a lot of hooks respond, it could take a while.
Comment #9
NancyDruHere it is in patch form.
Comment #10
NancyDruCommitted
Comment #11
NancyDruIncluded in 7.x-1.1-beta2.