- Issue created by @xavier.masson
The ContextValidator
service in the gin_lb
module contains hardcoded lists of form IDs and regular expressions used to determine whether a form should be styled and enhanced by Gin Layout Builder.
Currently, there is no supported way for external modules or themes to declare their own forms as part of the Layout Builder context. This limits the flexibility of Gin LB integrations and violates Drupal’s extensibility best practices.
ContextValidator::isLayoutBuilderFormId()
unless its ID is hardcoded.ContextValidator
to lazy-load the form ID and regex lists.hook_gin_lb_form_ids_alter(array &$form_ids)
hook_gin_lb_form_id_regexes_alter(array &$regexes)
ModuleHandlerInterface
.ThemeManagerInterface
if necessary (e.g., context-based theming decisions).getFormIds()
and getFormIdRegexes()
methods in ContextValidator
.moduleHandler->alter()
to trigger hook implementations for both arrays.None directly. This change affects backend extensibility only.
None.
New alter hooks introduced to extend Gin Layout Builder context form detection:
function hook_gin_lb_form_ids_alter(array &$form_ids): void; function hook_gin_lb_form_id_regexes_alter(array &$regexes): void;
These allow external modules and themes to register additional forms for styling and enhancements.
None.
The gin_lb
module now supports extending form detection logic used by ContextValidator
via alter hooks. Use hook_gin_lb_form_ids_alter()
and hook_gin_lb_form_id_regexes_alter()
in your module or theme to register custom forms for Gin LB enhancements.
Active
1.0
Code