[3.0] Offer the default variant wherever the variant list is built - #9668
Open
albertlast wants to merge 1 commit into
Open
albertlast wants to merge 1 commit into
albertlast wants to merge 1 commit into
Conversation
Theme::loadVariant() prepends a variant named 'default' to whatever a theme declares in theme_variants, so that is the list a member is actually served from. Two other places build their own list by reading theme_variants out of a theme's index.template.php and never add it: the variant settings on the admin theme page, and the variant picker a member chooses a theme with. The picker is where it shows. A member whose stored variant is 'default' finds it missing from the list it checks against, so the selection falls back to the first variant the theme declares and the picker offers no way back to the one they had. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Theme::loadVariant()prepends a variant nameddefaultto whatever a theme declares intheme_variants:That is the list a member is actually served from, and
data-variantinindex.template.phpfalls back todefaultwhen no variant is selected. Two other places build their own list instead, by readingtheme_variantsback out of a theme'sindex.template.phpwith a regex, and neither adds it:Admin\Themes::setSettings()— the variant settings on the admin theme page.ThemeChooser::pickTheme()— the variant picker a member chooses a theme with.Both are parsing a different theme's file rather than the loaded one, so
loadVariant()has never run over the value they hold.Where it shows
The picker is the one a member meets.
selected_variantis looked up in the list built above, and when it is not found:So a member whose stored variant is
defaulthas the selection silently moved to the first variant the theme declares, and the picker offers no way back to the one they had.On the admin page the same gap means the "default variant" setting cannot be set to the variant that is in fact the default.
Note on thumbnails
Neither site needs a new image. Both already fall back to the theme's plain
thumbnail.pngwhenthumbnail_<variant>.pngis absent, which is the pathdefaulttakes.The default theme declares no variants at all, so nothing here changes for it — this affects themes that ship variants.
Issues References (Fixes|Related|Closes)
Related to #7933.
🤖 Generated with Claude Code