OptionsWidgetBase options are stale

Created on 14 November 2017, almost 7 years ago
Updated 20 November 2023, 10 months 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