[Discussion] blocked implementations and generic stuff

Created on 12 December 2024, 3 months ago

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 Layout Builder offcanvas followup Active (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 🐛 Language dropdown: active state Active , 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 [5.1.x] Use icons Active , 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

🌱 Plan
Status

Active

Version

5.1

Component

Miscellaneous

Created by

🇫🇷France Grimreaper France 🇫🇷

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024