Trying to put admin theme elements in the front theme is a challenge, and it encounters a lot of side effects.
That's why I am asking myself if this is the right / sustainable approach.
I have not tested
https://www.drupal.org/project/lb_plus β
yet, but maybe it has a better approach.
Below are some thoughts I want to share for discussion.
Gin LB's scope:
- I would like to remove the module's impact on the "front" part of Layout Builder form, so limiting Gin LB to the offcanvas (it was also asked in
β¨
[V2] Allow configuration enable/disable for some features
Active
). Working with design systems in UI Suite, I think the front part should be ported by the front theme for design consistency.
- Is it the module responsibility to put layout builder form elements (save layout, revert changes, etc) in a custom offcanvas and generate a fake secondary Gin toolbar?
Side effects:
1. template suggestions:
Gin LB provides templates suggestions to ensure its templates that will be used.
If the front theme provides its own template suggestions, as the theme hooks are executed after the module hooks, it will be the theme template suggestions that will take precedence. And that is normal. This requires each front themes a special support of Gin LB. Yesterday I finally had been able to contribute back a generic solution in https://git.drupalcode.org/project/ui_suite_bootstrap/-/tree/5.0.x/start...
2. preprocess/process functions:
If the front theme provides process functions to form elements, it should not be executed in the case of Layout Builder. Each themes have to handle that.
Same, solution in UI Suite Bootstrap starterkit.
3 CSS:
Gin's CSS is relatively ok and scoped to not have side effects. But library dependencies introduce Claro's CSS which is not scoped and provoke side effects on impacted pages.
A solution would be to have a dedicated scoped CSS in Gin (or Gin LB) with everything required but this would require a huge amount of work.
4 JS (I don't think it is fixable):
Example of double ajax spinners: if the front theme provides its own ajax progress theming like https://git.drupalcode.org/project/ui_suite_bootstrap/-/blob/5.0.x/asset..., then there are 2 spinners.
I guess there will also be interference if the front theme is providing modal/dialog API theming too.
Gin LB benefits:
Other subject: Clarify that the module is intended to be used when Gin is not the current theme displayed:
https://git.drupalcode.org/project/gin_lb/-/blob/1.0.x/src/Service/Conte...
public function isValidTheme(): bool {
...
$active_theme = $this->themeManager->getActiveTheme();
if ($active_theme->getName() === 'gin' || \array_key_exists('gin', $active_theme->getBaseThemeExtensions())) {
$this->isValidTheme = FALSE;
}
So issues like:
Where the Layout Builder Admin Theme
https://www.drupal.org/project/layout_builder_admin_theme β
module is used should not be supported.
Need to check if Gin LB checking if the current theme is Gin is impacted or not.