Using a display extender, I have a display option form that pops up in the modal that had a $form['#submit'] array of callbacks to execute. When the form is submitted, those callbacks are not actually executed. Not sure if this is by design (as I can see that's why we have views_plugin_display::options_submit()), a bug in Views or CTools, but it lead to some confusion as my submit handler does data cleanup that I wanted to execute.

CommentFileSizeAuthor
#5 views-1278580-5.patch639 bytestim.plunkett

Comments

dave reid’s picture

Title: $form['#submit'] not executed inside a display options modal » $form['#submit'] not executed when the 'Apply' button is clicked inside a display options modal
dave reid’s picture

Actually now I think I know the reason why - the $form array when passed from views_ui_edit_display_form() to views_plugin_display::options_form() isn't actually the root form array, it's $form['options']. We should be giving access to the original $form array somehow. Maybe a third parameter of $complete_form

dawehner’s picture

Aaaaaaaaah davereid is in the queue :) My mail inbox runs away... :)
Thanks for creating all this detailed issues!

All this forms have $form['buttons']['submit']/$form['buttons']['cancel'] etc.
As far as i remember if you have a custom submit handler on a sub-form-element only the sub submit handlers are executed.
Could this be a case here?

dawehner’s picture

Why do you not use options_submit in your display extender?
Just wondering whether this would be the better way to actually do it.

tim.plunkett’s picture

StatusFileSize
new639 bytes

I'm not sure if this is the same issue, but neither row or style plugins seem to be getting their options at all.
Inside $form, their section is nested within 'options'. I couldn't track down why, but this fixes it.

I'm posting to this issue because I think they are related, but if I'm wrong I can open a new one.

dawehner’s picture

Thanks! Commited to 7.x-3.x. This seems to be some leftovers from the UI update, but i really don't think that this was the issue mentioned above.

dawehner’s picture

Status: Active » Closed (won't fix)

I still think that you shouldn't set $form['#submit'] for yourself in the display extender but use options_submit, so let's mark this as won't fix.

Feel free to open if i'm wrong.