The button uses drupal_goto, which stops processing. I see that the module tries to push itself at the end of the processing queue with hook_module_implements_alter, but that's not enough apparently in Drupal 7. Even core functions are skipped, like the one that assigns default view-by-all grants for published nodes. From modules, in my setup, FileFiled Paths is also skipped.
I believe that hook_module_implements_alter should be removed and drupal_goto changed to something else, that would always run at the end of all processing. Attached is a patched that demonstrates this by replacing $_GET['destination'], which solves all of the mentioned problems. It does however have a sideeffect of losing any destination that was set before. Perhaps it is possible to generate destination with another nested destination value?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | addanother-breaks-insert-processing-1393526.patch | 3.44 KB | nicholasthompson |
| addanother_redirect.patch | 670 bytes | TripleEmcoder |
Comments
Comment #1
catorghans commentedthanks!
I think this should be in the module.
Comment #2
kmare commentedHello,
I tried that patch, but it didn't work for me. It actually threw me a PDO exception 23000.... there are other goto functions in the go, shouldn't they be updated too?
Comment #3
nicholasthompsonThey should be, yes. Drupal Goto shouldn't be used to redirect form submission.
I'll see if I can get a patch for this now.
This actually breaks Node Access on our in-dev system; a node saved with "Save and Add Another" gets no entries in
{node_access}.Comment #4
nicholasthompsonThis patch (which can be applied using
git applyto the 7.x-2.x branch) changes the system to use submit handlers on the buttons, rather than drupal_goto.I have tested this locally and it seems to fix the issues I had.
Comment #5
kmare commentedThank you nicholasThompson!
Your patch works great on 2 projects I'm working on, would be awesome if it could be applied upstream.
Comment #6
robin monks commentedApplied to 2.x-dev.
Thanks for your work here nicholas!
Comment #8
larowlanIn a submit handler $form_state['redirect'] = $some_path should be enough
See eg http://cgit.drupalcode.org/commerce_node_checkout/tree/commerce_node_che...