theme_settings_convert_to_config() shouldn't save unknown keys into theme configuration objects

Created on 25 November 2015, over 9 years ago
Updated 5 June 2024, about 1 year ago

Problem/Motivation

Found while porting the Browsersync module to D8.

If you hook_form_alter() some elements into \Drupal\system\Form\ThemeSettingsForm, all of the values are saved into the theme config object automatically. However there's no schema for those pieces of configuration and as far as I can see no way of declaring a schema for them. Based on what I've reviewed contrib modules should be adding their config schemas to theme_settings.third_party.*.

The fact that these settings get saved automatically to the top level of theme config results in config schema mismatches that can be seen with https://www.drupal.org/project/config_inspector .

Proposed resolution

Don't save unknown keys in theme_settings_convert_to_config(), only save a whitelist of keys from core.

Remaining tasks

Patch
Tests
Review

User interface changes

n/a

API changes

TBD

Data model changes

TBD, should be none.

🐛 Bug report
Status

Postponed: needs info

Version

11.0 🔥

Component
Theme 

Last updated about 11 hours ago

Created by

🇨🇦Canada star-szr

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.

  • Needs documentation

    A documentation change is requested elsewhere. For Drupal core (and possibly other projects), once the change has been committed, this status should be recorded in a change record node.

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.

  • 🇺🇸United States smustgrave

    Anyone know if still an issue in D10? There have been tons of works around config schema

  • Status changed to Closed: outdated 15 days ago
  • 🇳🇿New Zealand quietone

    There has been no confirmation that this is still a problem of a currently supported version of Drupal. Therefore I am closing this issue.

    If there is incorrect add a comment and re-open the issue by setting the issue status to 'Active'.

Production build 0.71.5 2024