Panels should not use drupal_goto('admin/panels') in the delete confirm form submit handler, it should use return 'admin/panels';.

If you use drupal_goto(); then other modules can not add another submit handler to the form. I'm stumbling on this problem while adding support for panels module in my nodewords module (which adds META tags to pages).

Patch attached.

CommentFileSizeAuthor
panels.drupal_goto.patch.txt559 bytesRobrecht Jacques

Comments

Robrecht Jacques’s picture

Status: Needs work » Needs review
Robrecht Jacques’s picture

Some extra information from #drupal IRC:

robrechtj
how do i add a function to be executed when a form is submitted in 4.7?
in form_alter : $form['#submit']['my_function'] = array(); doesn't seem to work for a delete_confirm form
prolly because it is executed after another one that does a redirect??
killes
robrechtj: maybe
Heine
robrechtj, any specific confirmation form?
robrechtj
Heine: panels_confirm_delete
Heine
ok
file a bug
It does a drupal_goto('admin/panels');
robrechtj
Heine: what should it do instead? if it wants to redirect after submit?
a return 'admin/panels' ?
Heine
yes
robrechtj
ok - i'll submit it
chx
do we have a fapi bug here?
Heine
chx, no
evil drupal_goto in a submit hook
So you can only carry out extra work if you are before it and you can't change the redirect
chx
exactly
Heine
I'm afraid *many* contrib modules do tis
slantview’s picture

+1 Looks good to me.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed. Thanks for the patch!

Anonymous’s picture

Status: Fixed » Closed (fixed)