I noticed this while testing #270365: Add a 'editor render callback' to pane content types. However, I can confirm it's broken even without that callback, so I'm submitting this as a separate bug report. I don't grok all the AJAX/JS going on enough to be sure where the bug lies, or I'd post a patch along with this. ;) Here's the problem...

- Go to the display editor

- When you add a new pane, the pane title bar is yellow, the title is set correctly with the results of title callback, and the contents of the pane are properly functioning as a collapsible handle. You can click on it to expand the little message that says "Dynamic content previews have been disabled to improve performance and stability for this editing screen.", etc.

- However, if you edit an existing pane (or even the pane you just added), once you click "Save" in the modal dialog for that pane, the pane's title bar is nicely updated to become yellow and add the *, however, the pane content is now broken. The collapsible arrow icon is gone, and you can no longer click on it to show/hide the contents of the pane.

This is particularly troubling once #270365: Add a 'editor render callback' to pane content types lands, because it means that after you edit a pane, all the goodness from your editor render callback is lost, and you end up with the results of title callback in your pane.

I'll see if I can track this down, though my AJAX debugging environment (and fu) leave a lot to be desired. ;) Any pointers in the right direction would be most appreciated.

Thanks!
-Derek

CommentFileSizeAuthor
#1 270559_edit_pane_collapse_toggle.1.patch979 bytesdww

Comments

dww’s picture

Title: After editing a pane, pane content/title is lost in the display editor » After editing a pane, the "portlet" collapse/expand behavior is lost
Assigned: Unassigned » dww
Status: Active » Needs review
StatusFileSize
new979 bytes

Upon further investigation, the title I was seeing are due to a problem where panels_content_config_edit_form_submit() doesn't call panels_show_pane(), yet panels_content_config_add_form_submit() does. So, the editor render callback needed to be invoked again at the end of panels_content_config_edit_form_submit(), which is what's now happening over at #270365-8: Add a 'editor render callback' to pane content types.

However, the real bug here is that the per-pane collapse/expand behavior is lost after you edit a pane. I don't fully understand why, but I'm close. ;) In modal_forms.js, around line 123 in the DRUPAL-5--2 version, you'll see this code:

  else if (data.type == 'replace') {
    $('#panel-pane-' + data.id + ' .panel-pane-collapsible')
      .html(data.output)
      .each(Drupal.Panels.bindPortlet);
    Drupal.Panels.changed($('#panel-pane-' + data.id));

    // dismiss the dialog
    $('#panels-modal').unmodalContent();
  }

That call to .each(Drupal.Panels.bindPortlet); doesn't seem to do anything at all. If you rip it out, you get the identical behavior. So, something about that is failing to invoke bindPortlet() on the edited pane. :( This explains why the collapse/expand behavior is lost, since it's bindPortlet() that adds the toggle behavior for the pane's content.

If you add the 'panel-portlet' class to the pane, and then call bindPortlet(), it all seems to work just fine. See attached patch. I'm not positive this is right, but it works. ;)

merlinofchaos’s picture

Status: Needs review » Fixed

Committed! Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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