I created a node edit override panel for a custom content type (node/%/edit). I had some instructions above the general edit form in a different pane and a referenced node below. It looked and worked great until I tried to go back and delete one of the nodes. Here's what happens. While in edit, I scroll to the bottom of the form and click delete. That takes me to the next page which asks if I'm sure, and there I click delete. The page loads but alas, nothing happens, the node is not deleted. I have another node override panel (node/%) that overrides this node type plus one more. The other node type still deletes fine. I got rid of the edit node override panel to see if I could then delete the node, but it didn't work. I guess the damage was done. Should I start over and create a new node type? Is this a bug with Panels 2, that creating a node edit override disables the ability to delete? Any guidance is appreciated.
Comments
Comment #1
nath commentedI think we have the same problem on our site.
Comment #2
internetter commentedI have tracked down the problem to this:
- the function drupal_validate_form() is never called
- if I click on the delete button then "index.php" is one time called with "POST". But then it is redirected with a 302-redirect to the same page:
/node/[ID]/delete with GET-method. But the values of the POST-formular are lost.
- I think the redirect in the function "panels_context_create_node_edit_form()" is responsible, File: /sites/all/modules/panels/contexts/node_edit_form.inc
- the redirect is always executed. In the function it is only tested if "$_POST['op'] == t('Delete')". But this is also in the Confirm-form.
Solution:
- test also if " && isset($_POST['confirm'])"
- or test the URL:
if ($_POST['op'] == t('Delete')) {
# error_log('Diese Umleitung hier ist schuld: '.__FILE__.'::'.__FUNCTION__);
// Note: we redirect from node/nid/edit to node/nid/delete to make the tabs disappear.
if ($_REQUEST['destination']) {
$destination = drupal_get_destination();
unset($_REQUEST['destination']);
}
if (!(arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'delete')) {
drupal_goto('node/'. $node->nid .'/delete', $destination);
}
}
Note: There is a comment:
> // Note: we redirect from node/nid/edit to node/nid/delete
> to make the tabs disappear.
Hope that helps...
Comment #3
mnlund commentedThe above stated is definently a problem, and you fix it with replacing line 43 with this:
if ($_POST['op'] == t('Delete') && !isset($_POST['confirm'])) {Comment #4
esmerel commentedNo fixes will be added to the 2.x line.