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:

  1. Click "Customize this page" on bottom IPE bar
  2. Choose add text
  3. Type in the textfield then close the panel before Panopoly Magic updates the preview, under 1 second.

Comments

adamsro created an issue. See original summary.

adamsro’s picture

So 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?

dsnopek’s picture

Status: Active » Needs review

Thanks!

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. :-)

adamsro’s picture

Thanks, yeah it's been a rather minor, but hard to pinpoint the exact cause of, irritation for awhile.

dsnopek’s picture

StatusFileSize
new564 bytes
new463 bytes

I 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 the form argument. So, attached is a slightly revised patch.

I'm gonna try and get some more testing in before committing, though.

adamsro’s picture

Oh, good point on the $form node. Patch is, of course, in use on my setups and working.

  • dsnopek committed 65ea0dc on 7.x-1.x
    Update Panopoly Magic for Issue #2748813 by dsnopek, adamsro: Redirected...
dsnopek’s picture

Status: Needs review » Fixed

Sorry for the delay! Committed :-)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rameshbalda’s picture

Still 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;
}
}
}
}