If you create a new node and are only authorized to transition to one state, you shouldn't be presented with that state, it should be automatic.
It appears that this was previously the behaviour, but that it was changed with #57905 (Bug Fix #2). The fix (maybe) makes sense for nodes that are already existing and stuck in "(creation)", but it doesn't make sense for new nodes, which will always be in "(creation)" state.
The code is in workflow_form_alter:
$min = $states[$current] == t('(creation)') ? 1 : 2;
if (count($choices) < $min) { // bail out if user has no new target state(s)
return;
}
The problem is that when you create a new node, and only have one choice, it'll display the radio button (and comment box), when it should display neither. If you don't display it, you won't get stuck in the creation state, since there is already code to force it to something else in nodeapi (case "insert").
So there's (at least) two ways to fix this:
* Change the condition above to t('(creation)') && $form['nid']['#value'] or something like that (merlinofchaos suggested that, I don't really know the drupal insides well at all)
* Change it back to $min = 2. In nodeapi, set the state to the only possible one when the edit form is submitted. Similar code also exists in the workflow_tab_page, but it should be OK there, since you can't get to the workflow tab on nodes that are not yet created.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | workflow.module.patch.txt | 557 bytes | duncf |
Comments
Comment #1
merlinofchaos commentedI vote for option 2, and not letting (creation) ever be valid for a node *unless* there are no valid transitions from (creation) at all.
Comment #2
duncf commentedWell, here's a patch for option number 1. (I've had this one lying around for a while, sorry.)
Comment #3
mfredrickson commentedI believe workflow behaves as suggested: no information is displayed if only one transition is possible.
Please reopen (with a screen shot to document, please) if this problem persists in a recent version of workflow.
Comment #4
mfredrickson commentedComment #5
(not verified) commented