I added an image field to a content pane without a problem. But when trying to use that pane type to insert content onto a panel, the image would not be uploaded. These are the errors:

Notice: Undefined offset: 1 in _fieldable_panels_panes_load_entity() (line 265 of /.../sites/all/modules/contrib/fieldable_panels_panes/plugins/content_types/fieldable_panels_pane.inc).
Notice: Undefined index: field_pane_image in file_ajax_upload() (line 265 of /.../modules/file/file.module).
Notice: Undefined index: #suffix in file_ajax_upload() (line 274 of /.../modules/file/file.module).

Comments

jenlampton’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Status: Active » Fixed

Updated to the dev branch and image uploads are working :)
this is so cool.

cangeceiro’s picture

Status: Fixed » Needs work

re-opening as I am experiencing this on a sandbox site running the latest -dev branches of ctools/panels/fieldable_panels_panes.

When clicking "upload" the following errors are returned

Notice: Undefined offset: 1 in _fieldable_panels_panes_load_entity() (line 265 of /var/www/cmog/drupal/ubercart/sites/all/modules/fieldable_panels_panes/plugins/content_types/fieldable_panels_pane.inc).
Notice: Undefined index: field_images in file_ajax_upload() (line 265 of /var/www/cmog/drupal/ubercart/modules/file/file.module).
Notice: Undefined index: #suffix in file_ajax_upload() (line 274 of /var/www/cmog/drupal/ubercart/modules/file/file.module).

jenlampton’s picture

Are you also running the latest -dev of both ctools and panels?
Did you run update.php after you switched to the latest -dev versions?

merlinofchaos’s picture

Interesting. I did several image upload tests and didn't run into this using latest -dev of Panels and CTools.

Taking a look at the code, I see one possibility:

Does this problem only happen when adding a new fieldable pane, rather than selecting an existing one or editing an existing one?

It looks like that problem might be that the entity load currently assumes one exists in the database, and that would fit the problem we're seeing. If that's the case, I think the fix is to make sure that we can tell when we're in the process of creating one and to provide the default entity and make sure that is properly cached.

It may also be a different path on the Panels side as we-- my fix may only have worked for 'edit' and not for 'add'.

cangeceiro’s picture

I can confirm that the issue only happens when creating new panes. Inspecting the pane entity in PanelsPaneController::create() shows no signs of fields, though im not sure if it should at this point. I am going to continue to poke around and try to find a solution, but so far no dice.

merlinofchaos’s picture

Status: Needs work » Active

Right, it shouldn't show it at that point. Ok, I think I know at least what the notices are. I will play with this right now and see if I can figure it out.

Also marking active since needs work is a graveyard. :)

merlinofchaos’s picture

Ok, found the problem. The problem is that form caching can load the plugin .inc file outside of the plugin system, which is incompatible with the $plugin = array() format of the plugin. This is easy enough to correct using the 'small hook' function name instead. Patch forthcoming.

merlinofchaos’s picture

Status: Active » Fixed

Ok, committed the fix and pushed.

cangeceiro’s picture

That seemed to fix the php notices and now images are uploading properly to the form, but it also seems to have caused a regression. Now i am running back into this issue http://drupal.org/node/1253566#comment-4902880. So everything looks good on the form, after submitting all of the pane settings are gone. I see in the ctools code that you added $pane = $form_state['pane']; so i dont think the reference is getting lost in the same spot. for shits and giggles i put it in before the if statement in the ctools code and that was also to no avail.

cangeceiro’s picture

actually, ignore my last comment, i tried this in a separate sandbox i have setup and it worked. Ill test some more

merlinofchaos’s picture

I saw that once...and then couldn't make it happen again. I also updated CTools in between.

That leaves the possibility that there is *another* transient error that is causing htat but I am not sure what it would be.

cangeceiro’s picture

Status: Fixed » Closed (fixed)

Tested some more, it looks like the issue i outlined above was happening on a staging site that I am working with. On that site I had updated to the first Nov 3rd dev branch of ctools not realizing there was another release later the same day that had some of the caching fixes. updating to the later Nov 3rd dev branch fixed this issue. Im calling it fixed.

marsdk’s picture

I have the same issue as cangeceiro had with the new (not a reusable one) fieldable pane which does not seem to save any of the field data. Versions are - Ctools 1.x-dev, fieldable_panels_panes 1.x-dev, panels 3.0-alpha3. I have just updated to ctools 1.x-dev and clear cache, but nothing seems to do it. Any ideas ?

merlinofchaos’s picture

Update to latest Panels -dev. There's a fix in Panels that is needed to save data that was manipulated during ajax operations.

marsdk’s picture

Thanks. Just tested it with Panels -dev and it works like a charm.