The code in plugins/display-edit.inc takes good care of integrating the 'settings form' callback form for custom layout plugins and handling its submission also with the 'settings submit' callback. However, these form functions are not used directly, they are used via panels_ui_layout.class.php, which does invoke the form builder from display-edit.inc to build in custom elements to the form from layout plugins but will never invoke the submission handler as part of its submission handling. It merely invokes the generic parent submission handler in ctools_export_ui.class.php and a tiny bit of modifications on its own.

The result is that the submission handler specified for the layout plugin (as well as other submission logic implemented for panels layouts) is never invoked.

Found while working on a pretty early version of http://drupal.org/project/layout. Without this patch, the layouts will not be saved properly there, because the submission process is not integrated form the layout (builder) plugin.

Files: 
CommentFileSizeAuthor
layout-settings-submit.patch1.11 KBGábor Hojtsy

Comments

hey nifty, didn't see you guys had started up that project. glad to see it.

it does rather seem like that should be there. right now the flexible layout defines a callback for 'settings submit', but doesn't actually have the corresponding function. hmm. i guess it's adequate for flexible to simply have the layout settings array stored on the saved item - i guess you need more? that doesn't seem unreasonable, though it could result in some funky doubling of data, as the assumption is that the data in $display->layout_settings is enough.

in any case, this *seems* ok to me, without having tested. i'll poke at it later today, if merlin doesn't have more immediate thoughts to share.

Yeah, the flexible layout has the form function and the submit function provided in the plugin structure but it does not define those functions. What it does is that it updates the layout through AJAX callbacks, so it does not actually modify the form in any way. It probably used to do it, but it does not do it anymore. Not sure if there is any use case in panels itself where this is used, which explains the bug.

Currently as I found at least, the custom form submission callbacks are not invoked without the patch (as traced down from creating a custom layout builder and its form handling via the ctools export form handler that panels uses for builders).

my, how i love cruft.

i'll give it a look over later today for a basic sanity check.

Interesting project you guys are working on here:).

Isn't there also a corresponding validate?

@merlinofchaos - you'd think, right? one thing i intend to check on later.

Status:Needs review» Fixed

Okay, this looks mostly fine. I added a corresponding validate hook, committed and pushed. Thanks!

Status:Fixed» Closed (fixed)

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