- Issue created by @alemadlei
- 🇺🇸United States dobe
This isn’t a “I didn’t namespace correctly” quirk—this behavior matches what others have described and strongly feels like a core/Form API/SubformState scoping/merging bug.
What I observed:
AJAX replacement works when you return the exact subtree (by slicing the real #parents chain).
$form_state->setValue() does persist (values exist in the global state), but inside the plugin’s buildConfigurationForm() the subform cannot reliably getValue() its own updated values.
The only way I could surface those values was via $form_state->set() (global state), and that breaks isolation when the same plugin is used multiple times (e.g., per-region)—unique instance IDs or manual namespacing didn’t fix it. That collision/visibility problem makes the intended per-subform instance set/get flow brittle or effectively broken.
I tried the patches linked in https://www.drupal.org/project/drupal/issues/2798261 🐛 Using $form_state->getValue() in BlockBase's blockForm throws "subform and parent form must contain the #parents property" exception Needs work and they did not resolve what I’m seeing, so this is either the same underlying issue manifesting slightly differently or a closely related regression.
Next logical step:
Create a minimal reproducible case demonstrating:A subform (style option) with AJAX that sets a value,
Rebuild and attempt to read that value in buildConfigurationForm(),
Reuse the same plugin instance (e.g., per-region) to show the cross-instance collision when relying on the global workaround.