Gin Toolbar should not do anything if Gin theme is inactive

Created on 11 July 2025, about 18 hours ago

Problem/Motivation

Drupal theme negotiator allows for dynamic switching of front end or system themes, so there may be a reason to have Gin and Gin Toolbar installed, even if they are not the active system theme. However, in that case Gin Toolbar should not be expected to make any changes to the toolbar. In some cases this is true- there is a _gin_toolbar_gin_is_active function, and some of the hooks have code like:
// Are we relevant?
if (!_gin_toolbar_gin_is_active()) {
return;
}
However, many of the hooks do not have this safeguard and run regardless of whether gin is active. All of the hooks should have the above check.

Steps to reproduce

Install gin theme and gin toolbar but select a different system theme. Note that the toolbar is now filled with gin classes and styles, despite the fact that gin theme is inactive.

Proposed resolution

Add a check to all hooks to see if gin is the active theme.

๐Ÿ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States dgroene

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @dgroene
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland saschaeggi Zurich

    I guess we'll have to close this one as won't fix as there are some restrictions this won't work (at least it didn't in the past when we tried to achieve this but it's a while ago). Caching and other factors might be our enemies here, too.

    Best for this use case might actually be to use Claro. In the future there will only be Gin (in Core) without the option to choose a different admin theme which might solve this issue in a different way.

    I'll wait for Jรผrgen's input here as he might know if this is now possible or if there might be a workaround.

    Cheers

Production build 0.71.5 2024