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

Issue fork drupal-3387100

Command icon 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:

Comments

Grimreaper created an issue. See original summary.

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Active » Needs review
grimreaper’s picture

StatusFileSize
new1.4 KB

Uploading patch from MR for Composer usage.

smustgrave’s picture

Issue summary: View changes
Status: Needs review » Needs work

Completed the IS.

Left a todo in the steps to reproduce as I'm not seeing the issue.

grimreaper’s picture

Issue summary: View changes
Status: Needs work » Needs review

Hi @smustgrave,

Thanks, I have updated the steps.

grimreaper’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Needs work

Thank 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.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

anybody’s picture

I can also confirm this issue. config_inspector is very helpful to make it visible for different content types.

heddn’s picture

re #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.

heddn’s picture

Status: Needs work » Needs review

Do we need an update hook to resave all base field overrides again? I think that would be more disruptive then not.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

MR 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

heddn’s picture

They 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.

smustgrave’s picture

but without the re-save the problem isn't fully fixed though?

heddn’s picture

In our case, it was resolved without the need to re-save.

The values added were:

third_party_settings:
  content_translation:
    translation_sync:
      file: file
      alt: '0'
      title: '0'
bbrala’s picture

bbu23’s picture

The 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:

variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData

After re-saving, the 0 values get converted to string '0'
So, we might need an update hook.

codebymikey made their first commit to this issue’s fork.

codebymikey’s picture

Status: Needs work » Needs review

I'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_translation third party settings.

The resave occurs within the callback because the entity data is still untrusted as far as we're concerned.

bbrala’s picture

Yay main, rerolling

bbrala changed the visibility of the branch 3387100-missing-config-schema to hidden.

bbrala changed the visibility of the branch 3387100-missing-config-schema to active.

bbrala’s picture

Thanks!

Would like some feedback here from others regarding the do or do not save issue.

dcam’s picture

Status: Needs review » Needs work
Issue tags: +Needs update path tests

Apparently 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.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

codebymikey’s picture

StatusFileSize
new2.34 KB

Added static patch including the post update hook.

wim leers’s picture

Issue tags: +Experience Builder

Affects Canvas too: https://git.drupalcode.org/project/canvas/-/merge_requests/882/diffs?com... was forced to forward-port this.

alexpott’s picture

Priority: Normal » Major
alexpott’s picture

Status: Needs work » Needs review
Issue tags: -Needs update path tests

I 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.

penyaskito’s picture

Status: Needs review » Reviewed & tested by the community

Code looks perfect to me, I wouldn't change a comma.

alexpott’s picture

Triggered 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.

alexpott’s picture

longwave’s picture

Version: main » 11.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 22c7a860b85 to main and 1663b3a807f to 11.x and 93d8061f073 to 11.4.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • longwave committed 93d8061f on 11.4.x
    fix: #3387100 Missing config schema for core.base_field_override.*.*.*...

  • longwave committed 1663b3a8 on 11.x
    fix: #3387100 Missing config schema for core.base_field_override.*.*.*...

  • longwave committed 22c7a860 on main
    fix: #3387100 Missing config schema for core.base_field_override.*.*.*...

bbrala’s picture

Yay!