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

  1. Create subtheme (via console)
  2. Change toolbar setting
  3. 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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anruether created an issue. See original summary.

anruether’s picture

Issue summary: View changes
anruether’s picture

Status: Active » Fixed

Interesting, this happened when I had gin_toolbar deinstalled. After (updating and) reinstalling the subtheme settings came into effect.

anruether’s picture

Status: Fixed » Closed (works as designed)
anruether’s picture

Status: Closed (works as designed) » Active
FileSize
101.7 KB

I 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 toolbar what is set in gin settings.

All this applies to admin pages, the frontend theme picks up the correct subtheme settings!

anruether’s picture

I have gin_toolbar beta11 installed.

saschaeggi’s picture

Did 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.

anruether’s picture

Title: When a subtheme is used the toolbar settings from parent theme (gin) are used » Gin overwrites sub theme settings
Version: 8.x-3.0-alpha24 » 8.x-3.x-dev

> 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).

saschaeggi’s picture

Priority: Normal » Minor

Moving the priority of this issue to minor as subthemes in general are not officially supported
Hope somebody can step in for this :)

anruether’s picture

Interesting if I set gin to Legacy, Classic Drupal Toolbar any subtheme setting for the toolbar actually applies.

dqd’s picture

@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.

saschaeggi’s picture

@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

dqd’s picture

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.

Ah I see. Yeah that makes absolutely sense. I 100% agree. Thanks for chiming in on my thoughts. Great project by the way! +1

RdeBoer’s picture

Agree 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!

saschaeggi’s picture

@RdeBoer

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"?

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).

anruether’s picture

Interesting, 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.

RdeBoer’s picture

@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.

matiasmiranda’s picture

I 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

global:
  js:
    js/my-theme.js: {}
  css:
    layout:
      css/layouts/layout.css: {}
  dependencies:
    - claro/global-styling
    - gin/gin

@saschaeggi Thanks for the great work with Gin!

saschaeggi’s picture

@matiasmiranda thanks for the patch and glad you like it :)
@anruether can you confirm that this fixes your problem?

anruether’s picture

Status: Needs review » Reviewed & tested by the community

Yes! That works nicely. Thanks for the patch, @matiasmiranda!

I tested toolbar settings, various combinations and accent color.

saschaeggi’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all!
Special thanks to @matiasmiranda for providing a patch and @anruether for testing!
I've also tested it and don't see any regressions.

matiasmiranda’s picture

Great! happy to help. Thanks all!

saschaeggi’s picture

Status: Fixed » Closed (fixed)

included in alpha26 release

anruether’s picture

I created a follow up for darkmode and high contrast.

anruether’s picture

I created a follow up for darkmode and high contrast.

chrisck’s picture

Sorry 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:

libraries:
  - subtheme/global

Copy gin regions to subtheme:

# Regions
regions:
  header: 'Header'
  pre_content: 'Pre-content'
  breadcrumb: Breadcrumb
  highlighted: Highlighted
  help: Help
  content: Content
  page_top: 'Page top'
  page_bottom: 'Page bottom'
  sidebar_first: 'First sidebar'
regions_hidden:
  - sidebar_first

subtheme.libraries.yml

global:
  js:
  css:

  dependencies:
    - claro/global-styling
    - gin/gin

Is that all it takes to sub theme Gin?