Gin WSODs when is not active anymore after a custom theme negotiator swaps the theme

Created on 24 October 2025, 19 days ago

Problem/Motivation

Gin WSODs when is not active anymore after a custom theme negotiator swaps the theme, and Gin has the "Enable sticky action buttons" option enabled.

This is a Drupal CMS blocker because that option is always enabled if new Navigation in core is enabled + it affects the ability of Drupal Canvas to keep the selection the editor made in the library media selector from the semi-decoupled theme used for forms.

Not to be confused with the related issue 🐛 Gin does not render properly if set as active theme from a custom theme negotiator Active :

  • #3539391 covers visual issues when a negotiation does →
  • This covers a WSOD when a negotiation does →

Steps to reproduce

"call_user_func_array(): Argument #1 ($callback) must be a valid callback, function \"gin_form_after_build\" not found or invalid function name"

The reason is that Gin is adding an after_build handler, but the Gin theme is not loaded anymore, but the form is already cached by Drupal though. So the after_build still tries to run.

Proposed resolution

  • Move the after_build handler to the same class that is adding it, which will be loaded.
  • Check Gin (or a sub-theme or Gin) is active or early return the form without modifications.

Remaining tasks

Review.

User interface changes

None, as Gin is not active in that request anymore.

API changes

AFAIK handlers are not considered API.

Data model changes

None.

🐛 Bug report
Status

Needs review

Version

5.0

Component

Code

Created by

🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024