Didn't work with theme_switcher

Created on 23 July 2025, 4 days ago

If the default admin theme is not gin, the theme_switcher will not work right.

🐛 Bug report
Status

Active

Version

5.0

Component

Code

Created by

🇨🇳China lawxen

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

Merge Requests

Comments & Activities

  • Issue created by @lawxen
  • Pipeline finished with Success
    4 days ago
    Total: 147s
    #554835
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Can you please explain what you mean by "the theme_switcher will not work right". What's required is a list of steps on how to reproduce the problem and an explanation what should have happened instead.

    The changes in the MR would certainly have terrible side-effects, so that will not be merged. One reason being that the changes to _gin_is_active() would break the purpose of this method. It is there to determine if Gin is active, i.e. if Gin is configured to be either the frontend or the backend theme, or if it's the base theme of the current frontend or backend theme. The proposed change would just return TRUE if Gin is enabled, regardless of its usage.

    The changes in GinSettings would also deliver unexpected results. But reviewing the MR made me think whether we could simplify all those by removing all calls to $this->getAdminTheme() and use a static string gin instead, because we always want the settings of Gin when either of those methods is being called. Unless we're dealing with a sub-theme of Gin, whereas sub-theming is not officially supported anyway.

    In any event, using \Drupal::theme() would be a no-go and requires dependency injection instead.

  • 🇨🇳China lawxen

    @jurgenhaas Thanks for the detailed reply.
    1. Gin is not friendly for subtheme
    2. Gin/(Gin based Subtheme) not work with switch_theme

    Reproduced step of 2:

    1. Install drupal11
    2. Install and enable switch_theme ^2.1
    3. Enable Gin and configue it use dark mode (Not necessary, Just to see the problem more intuitively)
    4. Config path '/admin/content' use Gin or Gin based subtheme
    5. By deault admin theme is Claro, The page /admin/content didn't display right
    6. Config Gin as admin theme, The page /admin/content get right
  • Pipeline finished with Success
    3 days ago
    Total: 132s
    #555493
  • 🇨🇳China lawxen

    One reason being that the changes to _gin_is_active() would break the purpose of this method.

    I have revert the change _gin_is_active and add active theme check in it.

  • Pipeline finished with Success
    3 days ago
    Total: 132s
    #555494
Production build 0.71.5 2024