Using $form_state->getValue() inside of blockForm() throws an exception. See issue #2798261: Using $form_state->getValue() in BlockBase's blockForm throws "subform and parent form must contain the #parents property" exception.
I'd write a patch, but I can't find any examples of how ajax rebuilds are supposed to work now that #2537732: PluginFormInterface must have access to the complete $form_state (introduce SubFormState for embedded forms) went in.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | ctools_subform_state-2800951-6.patch | 1.11 KB | karlshea |
Comments
Comment #2
tedbowHere is a patch that fixes the error by calling but I would think it should be fixed in #2798261: Using $form_state->getValue() in BlockBase's blockForm throws "subform and parent form must contain the #parents property" exception.
I have not read up much on the SubFormState so likely this is the wrong way to solve it but it does work.
Comment #3
karlsheaAccording to #2798261-11: Using $form_state->getValue() in BlockBase's blockForm throws "subform and parent form must contain the #parents property" exception that's the way to do it—and it fixes it for me—but I still think someone that really knows how those SubFormState changes are supposed to work should weigh in.
Comment #4
mherchelFYI, the patch in #2 fixed it for me.
Comment #5
eclipsegc commentedSo... this was annoying. I attempted to fix this in core, we'll see if my suggestion is worthwhile over on the other issue, otherwise we may adopt this patch shortly just as a stop-gap.
Eclipse
Comment #6
karlsheaAs suggested in #2798261-32: Using $form_state->getValue() in BlockBase's blockForm throws "subform and parent form must contain the #parents property" exception, is there a reason that the form state input is needed at all here? It looks like changing
#default_valueto just use what's in$configworks just fine.Comment #7
karlsheaComment #8
japerryComment #9
damienmckennaPunting this to beta2.
Comment #11
tim.plunkettReviewed this in person with @EclipseGc, committed!
Thanks @KarlShea