Problem/Motivation
Problem
- When
#states
is attached to a form element that contains#markup
the following notice occurs:Notice: Undefined index: #type in drupal_process_states() (line 583 of core/includes/common.inc).
Cause
- This happens because a
#markup
element does not require the#type
to be set.
Proposed resolution
- Fix the PHP notice.
- Add a regression (kernel) test to ensure that this bug does not reappear in the future.
Notes
- There are no PHP/backend tests for #states right now, because the "functionality" on the PHP side is in essence just a json_encode(), so nothing worth to test.
Remaining tasks
- Make sure patch applies to 8.5.x and 8.6.x as well.
- Write an unit (kernel) test to ensure that the bug does not reappear in the future.
User interface changes
No.
API changes
No.
Data model changes
No