Problem/Motivation
There are limitations of what a theme can override because it can't have plugins like field formatter plugins and associated alter hooks.
A theme can't have services, so all alteration possible with services is out-of-reach.
And also currently the UI Suite Bootstrap theme has some utility classes that may be extracted out.
The following list is by point that "should" be alterable by themes. To open discussion.
Layout Builder
See #3490688: Layout Builder offcanvas followup (and parent issue comment's). Blocked because a theme can't alter a controller response because it should be altered with a service:
- add block:
- First step: the "Create content block" link
- First step: the block lists (may be alterable but hard)
- Second step when there are multiple block content types, the links (should links prop type normalize be applied to links render element?)
- other contrib modules form:
- layout builder browser: blocked because controller
layout builder reorder?no- layout_builder_block_clone: ok just adding a form id in a list
- https://www.drupal.org/project/drupal/issues/2999491 ?
- https://www.drupal.org/project/drupal/issues/3134371 ?
Active class
For authenticated users: OK, the library "core/drupal.active-link" is overridden, but an entire JS is duplicated just to use "active" class instead of "is-active" from Core.
For anonymous users: KO, see #3492206: Fix active class on link for anonymous, need to override a service.
In presenter templates (table.html.twig, views-view-table.html.twig), we have to parse some classes to check for the is-active class to detect properly if a cell is active. Because the class is added in:
- template_preprocess_views_view_table
- app/core/lib/Drupal/Core/Utility/TableSort.php
- app/core/modules/views/src/Plugin/views/area/DisplayLink.php
And there is an inconsistency between table and views table, because table place a proper boolean "active_table_sort" while Views no.
And the is-active class is also scattered in other places in Core.
Plugins
Media library widget
The "Show media item weights" when there are multiple medias selected can't be altered because it is in the field widget plugin.
Commerce
On https://rockinghop.fr/, I had to override the MultistepDefault plugin to override the actions method because there is an early rendering of a link:
$actions['next']['#suffix'] = Link::createFromRoute($label, 'commerce_checkout.form', [
'commerce_order' => $this->getOrder()->id(),
'step' => $previous_step_id,
], $options)->toString();
Code to extract
A lot of non Bootstrap related code lies in src/Utility. Inspired by Bootstrap 3 theme.
The previous maintainer of Bootstrap 3 started to extract this code into https://www.drupal.org/project/plus
In #3476981: [5.1.0] Use icons, some stuff may be placed into ui_icons?:
- the icon and icon_position properties added to some render elements such as link, submit
- the process link callback to add the icon automatically where it needs and handle the title attribute in icon_only case
In src/HookHandler/ThemeSuggestionsAlter.php, the Layout Builder route/form detection can be extracted. It will also be useful for Gin LB
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | ui_suite_bootstrap-3493509-23.patch | 43.97 KB | grimreaper |
| #9 | Capture d’écran du 2025-01-06 16-42-08.png | 21.43 KB | grimreaper |
| #6 | Capture d’écran du 2025-01-06 14-25-13.png | 49.16 KB | grimreaper |
| #4 | Capture d’écran du 2024-12-20 18-38-38.png | 9.94 KB | grimreaper |
| #3 | Capture d’écran du 2024-12-20 18-03-17.png | 31.91 KB | grimreaper |
Issue fork ui_suite_bootstrap-3493509
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
Comment #3
grimreaperComment #4
grimreaperI also have tested Layout Builder Browser.
Unfortunately instead of providing a #theme links, it wrap manually all its links into a container.
So I will handle that in another time.
Comment #5
grimreaperComment #6
grimreaperNo support of layout_builder_reorder, the structure of the provided links differs from the others. Wrapped into a container. It should be cleaned first in the module.
Comment #7
grimreaperComment #8
grimreapertest if displaying region label:
Comment #9
grimreaperLayout Builder Browser support.
Comment #10
grimreaperReady to discuss.
Comment #16
grimreaperPatch of the companion module only for composer usage.
Comment #17
grimreaperComment #18
grimreaperUpdated patch regarding #3517904: LB + LBB + SL: JS filters broken and fix removal of .
Comment #19
grimreaperComment #22
grimreaperComment #23
grimreaperComment #24
grimreaperComment #26
grimreaper