After saving `FieldConfig` entities, the old configuration is still being used: discovery bin needs to be manually cleared

Created on 22 August 2019, about 5 years ago
Updated 1 February 2023, almost 2 years ago

Problem/Motivation

While we were writing a test (a functional JS test, not an update path test: this is from \Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::testDialogAccess()), we noticed that changing a setting on a configurable field did not have any effect:

    // Test that setting the media image field to not display alt field also
    // disables it in the dialog.
    FieldConfig::loadByName('media', 'image', 'field_media_image')
      ->setSetting('alt_field', FALSE);
    ->save();

did not cause the alt setting to be FALSE.

The solution was adding:

  $this->container
      ->get('cache.discovery')
      ->delete('entity_bundle_field_definitions:media:image:en');

See #2994702-92: Allow editors to alter embed-specific metadata, as well as `data-align` and `data-caption` β†’
(comments 92 and 93)

Proposed resolution

Remove the need for

  $this->container
      ->get('cache.discovery')
      ->delete('entity_bundle_field_definitions:media:image:en');

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
FieldΒ  β†’

Last updated 5 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States oknate Greater New York City Area

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

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