In fieldable_panels_panes_preprocess_panels_pane() it's loading the fieldable_panels_pane entity in question from the database again, even though it's already be present on the $vars.

In the normal case, this is wasteful, since you already have perfectly fine object already loaded up.

But changing this will also allow Panopoly to simplify it's preview generating code for FPPs. In the past, Panopoly would actually save FPPs to the database just so that they get rendered correctly. But then we're saving something before the user has even pressed save!

Instead, we'd like to just render an unsaved FPP entity, and this function is causing trouble by loading the FPP from the database.

I'll post a patch in a moment.

Comments

dsnopek’s picture

Status: Active » Needs review
StatusFileSize
new666 bytes

Patch is attached! Please let me know what you think.

damienmckenna’s picture

Status: Needs review » Fixed

Good find, thanks!

dsnopek’s picture

Status: Fixed » Needs review
StatusFileSize
new655 bytes

Actually, sorry, I think that configuration key might only be set on Panopoly. :-/ Here is a better patch that should work anywhere! Again, sorry for not testing more widely...

dsnopek’s picture

StatusFileSize
new714 bytes

And how about for safety we check if that key exists first...

damienmckenna’s picture

Status: Needs review » Needs work

I'd forgotten to upload recent commits, can you please reroll that? Thanks.

dsnopek’s picture

Status: Needs work » Needs review
StatusFileSize
new709 bytes

Sure!

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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