FormHelper::processStates causes notices on type-less elements.

Created on 24 January 2017, almost 8 years ago
Updated 26 March 2024, 10 months ago

\Drupal\Core\Form\FormHelper::processStates checks whether the #type property is 'item'. However, the #type property is (afaik) optional and can be undefined for render items that aren't form elements. Compare with \Drupal\Core\Render::doRender, which checks:

    if (isset($elements['#type']) && empty($elements['#defaults_loaded'])) {
      $elements += $this->elementInfo->getInfo($elements['#type']);
    }

So \Drupal\Core\Form\FormHelper::processStates might also need an isset() check there. Since type-less render elements aren't form elements, they also need the #wrapper_attributes set.

Steps to reproduce

Proposed resolution

TBD

Remaining tasks

Update IS
Add test
Review

🐛 Bug report
Status

Closed: duplicate

Version

11.0 🔥

Component
Render 

Last updated 3 days ago

Created by

🇨🇭Switzerland cburschka

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024