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.
Redirected to page /panels/ajax/ipe/edit-pane/panelizer%3Anode%3A1%3Apage_manager/17/form
which prints json when working with IPE occasionally.
Steps to reproduce, clean install of distro:
- Click "Customize this page" on bottom IPE bar
- Choose add text
- Type in the textfield then close the panel before Panopoly Magic updates the preview, under 1 second.
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff.txt | 463 bytes | dsnopek |
#5 | panopoly_magic-ajax-endpoint-bug-2748813-5.patch | 564 bytes | dsnopek |
Comments
Comment #2
adamsro CreditAttribution: adamsro commentedSo the problem seems to be that the form in the model is called 1 second after edits are made to the editing pane, but the form may no longer be attached to the DOM at that time. Would adding a
document.contains()
check be enough?Comment #3
dsnopekThanks!
This has been a long-standing issue, that's been reported before, although right now I can't seem to find any of the old issues. I haven't tested your fix yet, but if it works -- I'm all for it! It'd be great finally put this one to rest. :-)
Comment #4
adamsro CreditAttribution: adamsro commentedThanks, yeah it's been a rather minor, but hard to pinpoint the exact cause of, irritation for awhile.
Comment #5
dsnopekI finally got around to testing this, and this patch totally works when following your steps to reproduce! Up until now, I've never been able to reproduce this consistently (because I didn't really know what was happening) so it's still possible there is a way to reproduce that this fix doesn't cover, but since it does legitimately fix these steps, that's great and it should be committed. :-)
I have one bit of code review: the patch is using
$form[0]
to get the DOM node out of the jQuery object, but we actually already have tho DOM node from theform
argument. So, attached is a slightly revised patch.I'm gonna try and get some more testing in before committing, though.
Comment #6
adamsro CreditAttribution: adamsro commentedOh, good point on the
$form
node. Patch is, of course, in use on my setups and working.Comment #8
dsnopekSorry for the delay! Committed :-)
Comment #10
rameshbalda CreditAttribution: rameshbalda commentedStill i face this issue in different scenario,i have used below code to fix this issue,
function hook_form_fieldable_panels_panes_entity_edit_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'fieldable_panels_panes_entity_edit_form' || $form_id == 'fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form') {
//prevent ipe error after save redirect to wrong url.
$tmp_destination = drupal_get_destination();
$path = drupal_get_path_alias($_GET['q']);
$pane_id = explode("/", $tmp_destination['destination']);
$panelizer_id = explode(":", $pane_id[4]);
//Home Page prevent redirect url to json output after ipe save.
if(isset($tmp_destination['destination']) && $tmp_destination['destination'] == "panels/ajax/ipe/edit-pane/panel_context:page-home::page_home_panel_context::::/".$pane_id[5]."/form") {
$site_frontpage = variable_get('site_frontpage', 'node');
$redirect = str_replace("?destination=panels/ajax/ipe/edit-pane/panel_context%3Apage-home%3A%3Apage_home_panel_context%3A%3A%3A%3A/".$pane_id[5]."/form", '?destination=' . $site_frontpage, $form['#action']);
$form['#action'] = $redirect;
}
//Node Page prevent redirect url to json output after ipe save.
if($panelizer_id[1]=='node') {
$node_id = $panelizer_id[2];
$page_manager = $panelizer_id[4];
$alias = drupal_get_path_alias("node/$node_id");
//echo "panels/ajax/ipe/edit-pane/panelizer:node:".$node_id.":pane_manager:".$page_manager."/".$pane_id[5]."/form";
if(isset($tmp_destination['destination']) && $tmp_destination['destination'] == "panels/ajax/ipe/edit-pane/panelizer:node:".$node_id.":page_manager:".$page_manager."/".$pane_id[5]."/form") {
$site_frontpage = variable_get('site_frontpage', 'node');
$redirect = str_replace("?destination=panels/ajax/ipe/edit-pane/panelizer%3Anode%3A".$node_id."%3Apage_manager%3A".$page_manager."/".$pane_id[5]."/form", '?destination=' . $alias, $form['#action']);
$form['#action'] = $redirect;
}
}
}
}