Problem/Motivation
Per #3395555-22: Add validation constraints to olivero.settings, type: theme_settings
not being fully validatable means not a single theme's settings can be fully validatable!
Steps to reproduce
N/A
Proposed resolution
Determine appropriate validation (and config schema tweaks) for:
theme_settings:favicon.*
→mimetype
,path
,url
only make sense ifuse_default
is set to FALSE. The more elegant solution would be to only allow any key besidesuse_default
ifuse_default
is set to FALSE. But that'd require virtually every theme in existence to modify their default settings. So instead, add validation logic that requires each of these to be NULL ifuse_default === TRUE
, and requires a valid value otherwise.theme_settings:logo.*
→ same as for*:favicon.*
theme_settings:features.*
→ this one is very tricky. The last significant work in this area was in 2018, in #2954884: Cannot save theme settings form for themes without logo or favicon features.core/modules/system/tests/themes/test_theme_settings_features/test_theme_settings_features.info.yml
correctly defines afeatures
key in the theme's*.info.yml
file. But not a single core theme does this! 😱 Which means thatfunction _system_default_theme_features() { return [ 'favicon', 'logo', 'node_user_picture', 'comment_user_picture', 'comment_user_verification', ]; }
applies to all core themes (or any other theme that doesn't specify
features
in its*.info.yml
).AFAICT this means that in principle every theme that specifies
features
in its*.info.yml
with only a subset of_system_default_theme_features()
MUST specify a corresponding tweak totype: theme_settings
, for example thetest_theme_settings_features
theme'sfeatures: - node_user_picture - comment_user_picture - comment_user_verification
SHOULD REQUIRE a corresponding:
test_theme_settings_features.settings: type: theme_settings label: 'Test theme settings' features: type: mapping label: 'Optional features' mapping: comment_user_picture: type: boolean label: 'User pictures in comments' comment_user_verification: type: boolean label: 'User verification status in comments' node_user_picture: type: boolean label: 'User pictures in posts'
… and the absence of this config schema tweak should result in a deprecation error.
Similarly, the absence of default configuration for each of these should also result in a deprecation error.
This part definitely requires theme subsystem maintainer review.
FYI, previous work on this area:
Merge request link
Remaining tasks
Get theme subsystem maintainer approval for the proposed resolution.
User interface changes
None.
API changes
TBD
Data model changes
TBD
Release notes snippet
TBD