OptionsWidgetBase options are stale

Created on 14 November 2017, about 7 years ago
Updated 20 November 2023, about 1 year ago

Problem/Motivation

\Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase::getOptions() computes the options for the widgets extending from that class and as it offers an alter hook it makes it possible to have dynamic options, which might change during a form rebuild. But as the options are set the hook will not be called anymore and not allow changing the options.

Proposed resolution

Don't cache the options or find a way to reset them before the form is being rebuild.

Remaining tasks

Add tests
Review
Commit

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Field 

Last updated 1 day ago

Created by

🇩🇪Germany hchonov 🇪🇺🇩🇪🇧🇬

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.

Sign in to follow issues

Merge Requests

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