- Issue created by @steven jones
- Merge request !10378Issue #3490435: States not being processed correctly on item form items. → (Open) created by steven jones
- 🇬🇧United Kingdom steven jones
Adding more words to the title of the issue.
Okay, so the tests failed as expected.
I wonder what the correct solution is here?I'm going to push the change to go back to the sub-optimal check for the type of element fix, as that would actually work correctly, though not optimally.
Then maybe we need some further discussion about how to resolve this. Do we need a new property on form elements:
'#states_attributes_target_key'
that gives the name of the attribute to push the states attributes on to?
Core can set this on item and password_confirm elements to change the target, and anything that wants to do this in contrib can do this too. - 🇬🇧United Kingdom steven jones
Unassigning myself and setting to needs work, since we need to decide what to do here, but we do have an improved test and sub-optimal fix in the MR
I have hit the same problem, although in my case the #type is 'container'. My code worked correctly when I applied patch #2700667-104: Notice: Undefined index: #type in Drupal\Core\Form\FormHelper::processStates() → , but as of D10.3.8, that patch no longer applies, and my code no longer works (the #states I've specified are ignored). When I apply the update in MR !10378, then my code works correctly again (fields are hidden or visible as they are supposed to be). So, MR !10378 looks good to me, although I haven't checked to see if it causes anything else to break.