Problem/Motivation
When enabling content translation on content entity types, the config entities core.base_field_override.*.*.* may have a third_party_settings.content_translation entry which does not have config schema.
Steps to reproduce
- Enable content translation and media modules
- Go on /admin/config/regional/content-language
- Enable translation for the image media type (keep every checkboxes in their default state)
- Save the config form
- Go on /admin/config/regional/content-language
- Enable translation for another media type (keep every checkboxes in their default state)
- Save the config form
- Use a module like config inspector (/admin/reports/config-inspector/core.base_field_override.media.document.thumbnail/list)
Note: this is reproduced for any media type translation enabled first.
Proposed resolution
Add schema
Remaining tasks
Review
User interface changes
NA
API changes
NA
Data model changes
Schema is added
Release notes snippet
NA
| Comment | File | Size | Author |
|---|
Issue fork drupal-3387100
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3387100-missing-config-schema
changes, plain diff MR !4768
Comments
Comment #3
grimreaperComment #4
grimreaperUploading patch from MR for Composer usage.
Comment #5
smustgrave commentedCompleted the IS.
Left a todo in the steps to reproduce as I'm not seeing the issue.
Comment #6
grimreaperHi @smustgrave,
Thanks, I have updated the steps.
Comment #7
grimreaperComment #8
smustgrave commentedThank you for the additional steps. I can confirm the issue with Media type.
But applying patch #4 does not fix the issue, cleared cache multiple times too.
This may need a test case too but trying to figure that out.
Comment #10
anybodyI can also confirm this issue. config_inspector is very helpful to make it visible for different content types.
Comment #11
heddnre #8: You might need to re-save the media type again for the string types to all get saved in accord with the schema format.
Comment #12
heddnDo we need an update hook to resave all base field overrides again? I think that would be more disruptive then not.
Comment #13
smustgrave commentedMR should be updated to 11.x
But if re-saving is needed to get to work then probably would need an update_hook, using batch API
Comment #14
heddnThey don't need to be re-saved to work. But rather to get the "right" order per the schema and convert any
1=>true, etc. But if we add a hook update, then it will cause a resave of all base fields, which is very disruptive. Many times that config doesn't even exist as an exported config. But if we force loading/saving, we'll add lots of noise/files and create possible confusion.Comment #15
smustgrave commentedbut without the re-save the problem isn't fully fixed though?
Comment #16
heddnIn our case, it was resolved without the need to re-save.
The values added were:
Comment #17
bbralaComment #18
bbu23The MR patch works for me in Drupal 11.2+, though to me this doesn't work without re-saving because in the case of "file" the stored value is integer 0, and it still causes the following error:
After re-saving, the
0values get converted to string'0'So, we might need an update hook.
Comment #20
codebymikey commentedI've rerolled the MR to target 11.x, as well as added a post update hook to only resave base field overrides which have the
content_translationthird party settings.The resave occurs within the callback because the entity data is still untrusted as far as we're concerned.
Comment #21
bbralaYay main, rerolling
Comment #24
bbralaThanks!
Would like some feedback here from others regarding the do or do not save issue.
Comment #25
dcam commentedApparently there was some question as to whether this needed tests (#8), but update paths do require tests. So I'm setting the status to Needs Work for that.
Comment #27
codebymikey commentedAdded static patch including the post update hook.
Comment #28
wim leersAffects Canvas too: https://git.drupalcode.org/project/canvas/-/merge_requests/882/diffs?com... was forced to forward-port this.
Comment #29
alexpottThis is now causing errors in contrib testing since #3606969: Content translation column group settings only show up once there are base field overrides saved landed.
Comment #30
alexpottI don't think we should hold this back on upgrade path tests. They are tricky beasts and this is using the ConfigEntityUpdater class so things are pretty standardised. Also saving config without schema is now deprecated so configuration in modules will be automagically fixed during install too.
Comment #31
penyaskitoCode looks perfect to me, I wouldn't change a comma.
Comment #32
alexpottTriggered the test-only test - https://git.drupalcode.org/project/drupal/-/jobs/10641177 - which shows that the updated
\Drupal\Tests\content_translation\Functional\ContentLanguageBaseFieldSyncWidgetTest::testBaseFieldSyncOptionsVisibleOnFirstLoad()now fails.Comment #33
alexpottComment #34
longwaveCommitted and pushed 22c7a860b85 to main and 1663b3a807f to 11.x and 93d8061f073 to 11.4.x. Thanks!
Comment #40
bbralaYay!