Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Themers have to generate schema since we don't provide a default config schema for a theme's THEME.settings.yml
Proposed resolution
- Add system_config_schema_info_alter() to create definitions for all themes that need one
- Inherit schema from a theme's base theme since base themes can add settings a theme's settings form - see
ThemeSettingsForm::buildForm()
The one issue with this approach is that dynamic adding schema makes static analysis of configuration files for translatable strings difficult. See #2235901-34: Remove custom theme settings from *.info.yml and subsequent comments.
Remaining tasks
- Agree approach
- Write patch
- Review
- Commit
User interface changes
None
API changes
None
Beta phase evaluation
Issue category | It is possible to argue that this issue is solving a bug. Theme settings forms are inherited through the base theme system therefore they should inherit the schema too. Also it makes the configuration saved through the form consistent. If we call this a task then we should do this because makes life easier for themers. I would argue that this is super important because it is the way that a lot of people start with Drupal at the theme level. |
---|---|
Issue priority | Normal because schema are not required and Drupal will continue to work. |
Prioritized changes | The main goal of this issue is reduce the fragility of creating themes. Ensuring that themes have config schema means that configuration saved through the theme settings form will be consistent. |
Disruption | Not disruptive since if a theme does not provide a schema it gets the schema it needs. If it has a schema then nothing is changed. |
Comment | File | Size | Author |
---|---|---|---|
#6 | 2382671.5.patch | 7.42 KB | alexpott |
#6 | 4-5-interdiff.txt | 971 bytes | alexpott |
#4 | 2382671.3.patch | 6.73 KB | alexpott |
#1 | 2235901-diff-do-not-test.patch | 2.95 KB | alexpott |
#1 | 2382671.1.patch | 16.41 KB | alexpott |
Comments
Comment #1
alexpottThe patch attached contains #2235901: Remove custom theme settings from *.info.yml since that has fixes this issue needs to progress.
Comment #2
alexpottSee issue summary / beta evaluation for why I've reclassified this.
Comment #4
alexpott#2235901: Remove custom theme settings from *.info.yml has landed.
Added tests.
Comment #6
alexpottBetter test coverage of everything! ftw.
Comment #8
joelpittetFYI Stubbed a page in the Theme Guide as we didn't have one yet for D8.
https://drupal.org/node/2623936
#2303861: Themers shouldn't need to write config schema was consolidated to this issue.
Comment #22
quietone CreditAttribution: quietone at PreviousNext commentedThere has been no activity for 9 years here so let's find out if this is still relevant.
Is this still relevant for Drupal 10?
Since we need more information to move forward with this issue, I am setting the status to Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #23
alexpottThis issue is still valid and would save themers time and not have to replicate stuff. Yes this is still relevant from Drupal 10.
Comment #24
Wim LeersSome work in this area has happened recently in #3416178: Add validation constraints to `type: theme_settings`.