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

Created on 25 November 2015, about 9 years ago
Updated 5 June 2024, 7 months 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 21 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.

Production build 0.71.5 2024