Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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 CreditAttribution: 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_value
to just use what's in$config
works just fine.Comment #7
KarlSheaComment #8
japerryComment #9
DamienMcKennaPunting this to beta2.
Comment #11
tim.plunkettReviewed this in person with @EclipseGc, committed!
Thanks @KarlShea