This affect both beta1 and beta3.

To reproduce:
"Customize this page" -> "Add new pane" -> "Add image" -> uploade an image -> "Finish" -> "Save" -> then go back to "customize this page" -> "Edit" that image pane -> "Remove" previously added image.

This results in an AJAX error:

An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /<Drupal_directory>/file/ajax/content_settings/field_basic_image_image/und/0/form-zXJAhwNBWp8QiWYNo-2SDkkicctqhDR9nF8UcHB-Zb4
StatusText: n/a
ResponseText: 
...
Error        The website encountered an unexpected error. Please try again later.                  
Error message
Recoverable fatal error: Argument 2 passed to drupal_array_set_nested_value() must be an array, null given, called in /full/path/to/<Drupal_directory>/site/includes/form.inc on line 2500 and defined in drupal_array_set_nested_value() (line 6422 of /full/path/to/Drupal/site/includes/common.inc).
ReadyState: undefined

The image is impossible to remove and the whole pane needs to get deleted instead.

CommentFileSizeAuthor
#5 1567704-fix-image-remove.patch3.08 KBbeeradb

Comments

populist’s picture

Status: Needs work » Active

I can verify that this is a problem. There is something tricky going on.

populist’s picture

Assigned: Unassigned » populist
Status: Active » Needs work
populist’s picture

Assigned: populist » beeradb
Status: Active » Needs work
beeradb’s picture

I've been taking a look at this. No definite solution yet but I figured I would post what is known so far.

This looks to be caused by the fieldable panel panes specific form_alters in panopoly_widgets_form_alter. Although most of the fields in that tree don't mind being form altered under the "General Settings" fieldset, the remove button stops working. The reason for this is #parents gets incorrectly set when the remove button is pressed, causing the image fid to not be properly cleared. Moving the image field (back) to the root of the form causes the button to behave correctly.

My favored approach for fixing this would be to create actual fieldsets for this stuff via field_group.module, which appears to implement this stuff in #pre_render methods. This would also have the added benefit of allowing placement of these fields to once again be controlled via the fieldable panel panes field config UI. Unfortunately, converting this to use the field_group module causes the image field to not properly populate on a node edit. I'm looking into why this is currently.

I'll post back when I have more on this.

beeradb’s picture

Status: Needs work » Needs review
StatusFileSize
new3.08 KB

This fixes the bug by moving the Content Settings fieldset into a pre-render method.

I still think long term we should look at letting the field group module handle this stuff, but it's probably beyond the scope of this patch. This patch should maintain the exact same behavior but allow images to be removed.

populist’s picture

Status: Needs review » Fixed

Lovely. I spent a lot of time struggling with this issue. Glad it got fixed and committed!

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

removed unnecessary details