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:

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

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

grimreaper created an issue. See original summary.

grimreaper’s picture

grimreaper’s picture

I 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.

grimreaper’s picture

Assigned: pdureau » grimreaper
Status: Active » Needs work
grimreaper’s picture

Issue summary: View changes
StatusFileSize
new49.16 KB

No 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.

grimreaper’s picture

Issue summary: View changes
grimreaper’s picture

test if displaying region label:

$regionLabel->addClass([
              'position-absolute',
              'z-1',
              'px-1',
              'text-bg-light',
            ]);
grimreaper’s picture

Layout Builder Browser support.

grimreaper’s picture

Assigned: grimreaper » pdureau
Status: Needs work » Needs review

Ready to discuss.

  • grimreaper committed 1c1e2494 on 5.1.x
    Issue #3493509 by grimreaper: Layout Builder Block Clone support. Add...

grimreaper changed the visibility of the branch 3493509-discussion-blocked-implementations to active.

grimreaper’s picture

Assigned: pdureau » Unassigned
Status: Needs review » Postponed
StatusFileSize
new17.76 KB

Patch of the companion module only for composer usage.

grimreaper’s picture

StatusFileSize
new19.21 KB
grimreaper’s picture

StatusFileSize
new34.07 KB

Updated patch regarding #3517904: LB + LBB + SL: JS filters broken and fix removal of .

grimreaper’s picture

StatusFileSize
new42.46 KB

grimreaper changed the visibility of the branch 3493509-theme-only to hidden.

grimreaper changed the visibility of the branch 3493509-discussion-blocked-implementations to hidden.

grimreaper’s picture

Title: [Discussion] blocked implementations and generic stuff » [2025-12] blocked implementations and generic stuff
Version: 5.1.x-dev » 5.2.x-dev
grimreaper’s picture

StatusFileSize
new43.97 KB
grimreaper’s picture

Assigned: Unassigned » grimreaper

  • grimreaper committed f97b0190 on 5.2.x
    feat: #3493509 Add companion module to support overrides not possible...
grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Postponed » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.