Problem/Motivation

If you have Gin installed but not set as the administration theme, and write a custom `theme_negotiator` to set the administration theme to gin, gin does not render correctly, and is unusable.

There's a lot that should be happening but isn't, but at the very least, the `_gin_is_active()` returns false when it should be true.

Steps to reproduce

  1. Install a new version of Drupal 11
  2. Download and install Gin
  3. Create a custom module with a theme_negotiator to set the theme to `gin` if the route is an admin route
  4. Ensure claro is the default admin theme
  5. Visit a page that should be in the admin theme. It is unusable.

Screenshots:
A screenshot of gin working correctly
A screenshot of gin working incorrectly

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork gin-3539391

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

miwayha created an issue. See original summary.

saschaeggi’s picture

Status: Active » Closed (won't fix)

I'm closing this as won't fix. We only support setting Gin as the default theme.

Best regards

miwayha’s picture

I wasn’t able to find that in the documentation.

Given that theme negotiators are part of Drupal core, can you please add this to the list of known issues?

I’d really like for Gin to be compatible with Drupal core. Would you please consider reopening this as a feature request?

saschaeggi’s picture

We're in the process of preparing Gin to be moved into Core, replacing Claro.

There are plans that in the future there will be no option to change the admin theme anymore. Given those circumstances, we won't further explore this.

ThemeNegotiators was more built with frontend themes in mind. Gin has some specialities which is beyond what Core imagined what an (admin) theme would provide.

I hope this helps

miwayha’s picture

Ok it is helpful, thank you. I’m aware that Gin will be the new default admin theme.

At this point, I’m just asking for any of the rest of this to be documented anywhere. I’m not seeing this mentioned in the current Gin documentation.

I’ve spent some time looking at the theme negotiator stuff on api.drupal.org, and I can’t find a mention that theme negotiators should only be used for front end themes.

I’m also having trouble finding an issue describing plans to disable admin theme configuration in future versions of Drupal. I would really be interested in reading that context.

This is all great info: I’m just asking that it be written down somewhere, or somewhere more discoverable than its current location.

penyaskito’s picture

Status: Closed (won't fix) » Needs work
Issue tags: +Drupal CMS stable release blocker, +Experience Builder

The site WSODs in the opposite case, where Gin is the default admin theme but the negotiator switches to another theme.

This is the case we are exploring at #3531415: [upstream] Can't select media from library in Canvas when Gin is installed, so this is a Canvas blocker + Drupal CMS blocker.

We're in the process of preparing Gin to be moved into Core, replacing Claro.

All the more reason to fix this in Gin.

penyaskito’s picture

huh? the simplest test ever fails, I cannot save the Gin settings form.

penyaskito’s picture

Back-porting #3541807: Clean-up Gin PHP might be a solution. But that requires a core patch. Wondering if this is reproducible at all in gin 6.x

jurgenhaas’s picture

Back-porting as suggested in #9 will never happen, that's only going to be part of Gin in core.

But that raises a valid question: is this reproducible with 6.x and the given patch? Note, that also requires Drupal core 11.x-dev

penyaskito’s picture

Status: Needs work » Needs review

The attached MR is fixing the problem for canvas.

The included test tbh is useless for testing the issue. I could reproduce this before outside of canvas just by trying to save the Gin settings form, but haven't been able to reproduce it consistently either. Happy to keep it or remove it as your will.

This is easily reproduced inside canvas / Drupal CMS 2.x-alpha1, but didn't find yet a way to trigger the problem if not in conjunction with such infrastructure.

penyaskito’s picture

But that raises a valid question: is this reproducible with 6.x and the given patch? Note, that also requires Drupal core 11.x-dev

I couldn't generate this scenario because of some other canvas bug making it incompatible with the Gin 6.x branch.
I'm still debugging that one, but I'm quite convinced this won't be an issue given #3541807: Clean-up Gin PHP.

This is quite a blocker for Drupal CMS/Canvas, so happy to create a follow-up to explore that, but it shouldn't be as critical as this is now.

miwayha’s picture

I tested this MR against the issue I reported, and the issue remains. I believe the canvas issue is a separate issue. I'm worried about things getting confused here; should we split this into separate issues?

jurgenhaas’s picture

Priority: Major » Normal
Status: Needs review » Needs work
Issue tags: -Drupal CMS stable release blocker, -Experience Builder

@penyaskito we shouldn't be worries about CMS 2.x, Canvas and Gin. The reason why Gin moves into core is exactly for that reason, that such issues will be covered. So, what you see in Gin 6.x right now will be going into Drupal 11.3 and therefore be part of Drupal CMS 2.0 as well.

Setting this back to NW then, as the MR doesn't resolve this original issue according to #13. Also moving back the severity because as @saschaeggi already mentioned, the use case of the issue is not supported.

penyaskito’s picture

OP was about setting gin as active when it isn't.
MR is about setting other theme as active when it isn't, and gin not breaking the page.

penyaskito’s picture

Status: Needs work » Active

penyaskito changed the visibility of the branch 3539391-gin-active-not-active to hidden.