Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
When I use a subtheme and set toolbar settings to legacy, the setting is not respected. Only if I set it in gin the setting changes.
Steps to reproduce
- Create subtheme (via console)
- Change toolbar setting
- Find that toolbar setting does not change
This applies to other gin settings as well (darkmode, etc).
(User overrides are not enabled)
Proposed resolution
Not sure how this is supposed to work or if I need to add something to the subtheme. But I would expect that the childtheme now handles the theme settings.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#18 | 3163630-18.gin_.allows-sub-themes-override-settings.patch | 4.31 KB | matiasmiranda |
| |||
#14 | manage-form-Gin-subtheme-error.png | 335.85 KB | RdeBoer |
#14 | manage-form-Seven-subtheme.png | 258.77 KB | RdeBoer |
#5 | Screenshot_2020-08-06 H4C Gin.png | 101.7 KB | anruether |
Comments
Comment #2
anruetherComment #3
anruetherInteresting, this happened when I had gin_toolbar deinstalled. After (updating and) reinstalling the subtheme settings came into effect.
Comment #4
anruetherComment #5
anruetherI messed up my settings, after trying again I am still seeing this. Also I am seeing a messed up vertical toolbar in some situations, see screenshot:
when gin is set to vertical toolbar and the subtheme to modern
when gin is set to horizontal modern and subtheme to vertical
In all other combinations (I tried) I am always seeing
the vertical toolbarwhat is set in gin settings.All this applies to admin pages, the frontend theme picks up the correct subtheme settings!
Comment #6
anruetherI have gin_toolbar beta11 installed.
Comment #7
saschaeggiDid you try it with the lastest dev builds from Gin & Gin_toolbar?
Seems you also have user overrides as well activated? Maybe somebody can step in which also uses a subtheme to Gin.
Comment #8
anruether> Did you try it with the lastest dev builds from Gin & Gin_toolbar?
Yes, it's the same behaviour.
> Seems you also have user overrides as well activated?
No, I turned them of (in the user edit page for the active user).
Comment #9
saschaeggiMoving the priority of this issue to minor as subthemes in general are not officially supported
Hope somebody can step in for this :)
Comment #10
anruetherInteresting if I set gin to
Legacy, Classic Drupal Toolbar
any subtheme setting for the toolbar actually applies.Comment #11
dqd@all consider subtheming as one of the Drupal-Go-To's to individualize a theme without repeating it all the time when a theme updates. The Drupal doc's are full of this recommended way. Setting subtheming feature to "Minor" should possibly be reconsidered as somewhat underrated. Apart from that: Gin is based on other themes using their subtheming feature, isn't it? Not my scope. That's why I am asking.
My motivation is a common example: Somebody wants another side region for additional dashboard like blocks showing and needs to overrride the Gin twig files and region info for that everytime Gin updates. But maybe I am missing something here.
Comment #12
saschaeggi@diqidoq you can subtheme Gin If you like to, there's nothing against it in the first place :)
At this point It's just not officially supported. This has multiple reasons but the most important one is that Claro also does not officially support subthemes and neither are Drupal Admin themes made to be subthemed in the first place, as there are some restrictions in comparison to frontend themes.
One good example why subthemes are not (yet) supported by Gin are all the library overrides which Gin currently needs to use to work as a sub to Claro, which at least will be the case until Claro will be the new default admin theme in Core.
With that all said let's see what the (near) future brings and if we can make this again a priority.
If somebody has a strong need for subtheming and wants to step in to fix the issues (described here or others) we'll include them in Gin for sure! :)
Cheers
Comment #13
dqdAh I see. Yeah that makes absolutely sense. I 100% agree. Thanks for chiming in on my thoughts. Great project by the way! +1
Comment #14
RdeBoerAgree with @diqidoq that not being able to easily subtheme is not a minor issue, but a major issue.
Agree with @saschaeggi that this is not so much Gin's fault, if it is indeed the case that "Drupal Admin themes aren't made to be subthemed" (I would like to learn more about this!).
If Drupal admin themes cannot be subthemed, without things breaking, then this needs to become a Major Drupal core issue.
To get a better handle on what's going wrong with the subtheming I first downloaded the latest Gin with:
composer require 'drupal/gin:3.x-dev'
I then created a basic subtheme of Gin along what is described here: https://www.drupal.org/docs/theming-drupal/creating-sub-themes
First I set the base theme in the subtheme's info.yml to "gin".
Most things work for me except for some button texts plus one really annoying thing: the cross-bar drag handles have disappeared from the Manage Form Display page:
I then changed the base theme to "seven". The combo of Seven base theme and the same subtheme did not suffer disappearing drag handles:
Any pointers as to why this may be?
What in general is the approach (until such time that core supports this) to make a subtheme of Gin work with the full Gin functionality and no "breakages"?
Thanks so much for your help and for this great theme!
Comment #15
saschaeggi@RdeBoer
You'll at least need to copy over all the overrides from
gin.info.yml
and you'll need to make adjustment to paths where necessary to have the base admin theme functionalities working. Most of the stuff will then work out of the box, others won't like the stuff which is mentioned in this issue.Again as said before this might change drastically once Claro is the new default theme in Core (as Claro uses a lot of overrides currently and therefore Gin and your subtheme need to do the same).
Comment #16
anruetherInteresting, I could not remember any other oddities during sub theme creation. But in fact, I DID copy all the library definitions to my subtheme and even added a link to the relevant (?) issues (Well done, former me ;) But I did not apply the patch from that issue.
Comment #17
RdeBoer@saschaeggi, @anruether
Thanks for your help.
Copying the gin.info.yml contents from "libraries-override:" all the way down into mysubtheme.info.yml, brought back the drag handles and fixed the styling issues.
In order to change the configuration settings, I just go to the Gin theme page, rather than my Gin subtheme page. Not a big deal.
Comment #18
matiasmirandaI modified
theme_get_setting
to use the default current theme, so now the subthemes can override the configurations. I tested it with a subtheme and It works properly.Note that also is required set Gin and Claro libraries as dependencies to get it work. This is how my subtheme libraries.yml looks
@saschaeggi Thanks for the great work with Gin!
Comment #19
saschaeggi@matiasmiranda thanks for the patch and glad you like it :)
@anruether can you confirm that this fixes your problem?
Comment #20
anruetherYes! That works nicely. Thanks for the patch, @matiasmiranda!
I tested toolbar settings, various combinations and accent color.
Comment #22
saschaeggiThanks all!
Special thanks to @matiasmiranda for providing a patch and @anruether for testing!
I've also tested it and don't see any regressions.
Comment #23
matiasmirandaGreat! happy to help. Thanks all!
Comment #24
saschaeggiincluded in alpha26 release
Comment #25
anruetherI created a follow up for darkmode and high contrast.
Comment #26
anruetherI created a follow up for darkmode and high contrast.
Comment #27
chrisck CreditAttribution: chrisck commentedSorry to bring up an old issue. I've found that copying the libraries-override section from the gin.info.yml to a subtheme.info.yml is not required anymore in 8.x-3.0-rc1 thanks to the dependencies declared in #18. Creating a new Gin sub-theme turned out to be really easy and is working for me:
subtheme.info.yml
Set base theme as gin:
base theme: gin
Declare subtheme library:
Copy gin regions to subtheme:
subtheme.libraries.yml
Is that all it takes to sub theme Gin?