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.
As we are now capable of stacking '#submit' callbacks on forms, we might want to trigger actions on succesful form submission, but
at the moment a lot of _submit functions execute a drupal_goto, which would stop the rest of the actions from executing.
This patch moves the drupal_goto out of the submit functions, and instead allow them to return a path to redirect to.
Comment | File | Size | Author |
---|---|---|---|
submit_goto.patch | 12.39 KB | adrian | |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedcode reviewed and tested. works well and helps developers a ton.
Comment #2
rkerr CreditAttribution: rkerr commentedPatch applies with offsets. Have tested comment form, node form, login... and everything still seems to work normally.
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedComment #4
Dries CreditAttribution: Dries commentedCommitted to HEAD. Thanks. Should this be documented/announced somewhere?
Comment #5
ax CreditAttribution: ax commentedthis should definitely be documented/announced somewhere: at the modules update page, and somewhere in the forms-api-docs (you know better than me where exactly). thanks!
Comment #6
energie CreditAttribution: energie commentedIs it possible that the following problem is in connection with these changes?
http://drupal.org/node/49279
I try to explain the problem in the next example (flexinode module).
step 1. page "admin/node/types" has a hidden field named "ctype_id"
step 2. page "admin/node/types" is submitted to "admin/node/field" page. The target doesn't do anything with the submitted data now, it just put them in hidden fields to save for the next submission, but does not get this variable.
step 3. "admin/node/field" submits data that has missing fields because data is lost one step before.
http log:
"POST /?q=en/admin/node/field/ HTTP/1.1" 302 -
"GET /?q=en/admin/node/field HTTP/1.1" 200 9488
First data is submitted, no action is taken, then immediately redirected, post variables are lost.
I hope I was clear with this description.
Comment #7
pkls CreditAttribution: pkls commentedI think this problem also arose due to these changes: http://drupal.org/node/49123
The search in locale admin settings is failing because of the dropped POST variables during a drupal_goto.
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentedsee http://drupal.org/node/49799 for problems with locale search, node search, etc.