- Issue created by @wim leers
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
To prepare for working on a MR, I did some git + issue queue archeology and found some surprises:
- For historical context:
#1712250: Convert theme settings to configuration system ā
converted theme settings to the config system. That's where
logo.url
andfavicon.url
originate from, and that explains why it's sort of "internal config only", that gets computed on-the-fly intheme_get_setting()
and is never exposed to end users in the theme settings forms. - In fact, the last significant update to the theme settings infrastructure dates back to
#1507896: Allow theme developers to add the default logo filename to the theme's .info.yml ā
, where we introduced the ability to specify the default logo in a theme's
*.info.yml
ā¦ which seems wrong and should have been the theme'sconfig/install/*.setting.yml
? š„² This seems literally opposed to what #2954884: Cannot save theme settings form for themes without logo or favicon features ā did ā¦ š¬ - SVG is not yet allowed for the logo, only for the favicon: āØ Support SVG files for theme logo setting Needs work .
- This should update the docs at https://www.drupal.org/docs/theming-drupal/add-theme-configuration-schema ā
- For historical context:
#1712250: Convert theme settings to configuration system ā
converted theme settings to the config system. That's where
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
Wow, it's even more frightening than I thought:
\Drupal\system\Form\ThemeSettingsForm::submitForm()
still calls:theme_settings_convert_to_config($values, $config)->save();
which looks like this:
/** * Converts theme settings to configuration. * * @see system_theme_settings_submit() * * @param array $theme_settings * An array of theme settings from system setting form or a Drupal 7 variable. * @param \Drupal\Core\Config\Config $config * The configuration object to update. * * @return \Drupal\Core\Config\Config * The Config object with updated data. */ function theme_settings_convert_to_config(array $theme_settings, Config $config) { foreach ($theme_settings as $key => $value) { if ($key == 'default_logo') { $config->set('logo.use_default', $value); } elseif ($key == 'logo_path') { $config->set('logo.path', $value); } elseif ($key == 'default_favicon') { $config->set('favicon.use_default', $value); } elseif ($key == 'favicon_path') { $config->set('favicon.path', $value); } elseif ($key == 'favicon_mimetype') { $config->set('favicon.mimetype', $value); } elseif (str_starts_with($key, 'toggle_')) { $config->set('features.' . mb_substr($key, 7), $value); } elseif (!in_array($key, ['theme', 'logo_upload'])) { $config->set($key, $value); } } return $config; }
So this is quite literally still Drupal 7 code š³
- Merge request !6267Add validation constraints to `type: theme_settings` ā (Open) created by wim leers
- First commit to issue fork.
- First commit to issue fork.
- š§šŖBelgium svendecabooter Gent
I have added a commit trying to make the theme_settings.favicon and theme_settings.logo a dynamic type, that only contains the underlying path / url / ... config, if the 'use_default' boolean has been set to false.
This as per phenaproxima's suggestion. - Status changed to Needs work
11 months ago 5:50pm 5 February 2024 - šŗšøUnited States phenaproxima Massachusetts
This seems like a good start, and a reasonable approach to the problem. I had a few comments.
- Status changed to Needs review
9 months ago 8:47pm 16 March 2024 - š§šŖBelgium borisson_ Mechelen, š§šŖ
The new config validation test is failing, but I don't understand why. This should be increasing the schema coverage?
- Status changed to Needs work
9 months ago 4:47am 17 March 2024 The Needs Review Queue Bot ā tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide ā to find step-by-step guides for working with issues.
- Status changed to Needs review
9 months ago 7:54am 17 March 2024 - š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
This needed to a rebase, not a merging in of upstream commits. Now it should work fine again š¤
- Status changed to Needs work
9 months ago 2:16pm 18 March 2024 - šŗšøUnited States smustgrave
So bad news didn't see the tests run
But good news is it was the new validator against config.
Appears to be some threads on the MR now though
- Assigned to wim leers
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
Yeah that rebase didn't help.
The output shows why:
$ vendor/bin/drush cr --quiet $ vendor/bin/drush config:inspect --statistics > MR.json [error] { "assessment": { ā¦
Running the same command locally:
[warning] Undefined array key "type" TypedConfigManager.php:217 [warning] Undefined array key "type" TypedConfigManager.php:217 [warning] Undefined array key "type" TypedConfigManager.php:217 [error] { "assessment": { ā¦
- Issue was unassigned.
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
Unblocked this. Others can continue now š
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
āØ Support SVG files for theme logo setting Needs work landed, which means SVGs are now allowed.
- š§šŖBelgium svendecabooter Gent
I rebased the MR branch with the latest 11.x.
Locally I also got the '5 errors in system.theme.global:' error, thrown in the pipeline output as well.
I then fixed incorrect config in 2 core themes. When running config:inspect locally, that fixes the issue.
However, the latest Gitlab CI pipeline still shows this error, plus (unrelated?) phpunit test failures.
Not sure what's going on there...