Bootstrap 5: remove preprocess hooks

Created on 3 October 2023, about 1 year ago
Updated 7 October 2023, about 1 year ago

Problem/Motivation

There are 6 preprocess hooks related to Patterns in the theme:

  • alert: DOM manipulation related to status-message presenter template. Can we move it to status messages preprocess?
  • card: It may be possible to use add_class filter and "in" operator (instead of substr). However, we need to be sure we are looping on an actual sequence. So, let's wait for Make the Twig loops safer Postponed to be ready.
  • dropdown: with only $variables['dropdown_id'] = Html::getUniqueId('bootstrap-dropdown'); looks easy to replace with Twig random() function.
  • nav_item: We can replace it with add_class() filter if we stop using Link render element here. URL objects are not welcomed in component templates.
  • navbar:
    • Html::getUniqueId is easy to replace by Twig function
    • _ui_suite_bootstrap_add_class look easy to replace by Twig filter. And it willbe the oportunity to remove _ui_suite_bootstrap_add_class
    • Let's keep addDarkSetting() for now. It will become useless with future version of upstream Bootstrap 5.
  • navbar_nav: Looks complicated. Let's wait 📌 Bootstrap 5: Convert menu, breadcrumb and pagers to the links prop type Needs review is finished first.

Preprocess of pattern is not allowed by SDC and will be removed from UI Patterns 2.x

Proposed resolution

Remove preprocesses from: alert, dropdown and most of navbar.

Propose (without commit) something for nav_item.

API changes

No breaking changes AFAIK.

📌 Task
Status

Fixed

Version

5.0

Component

Code

Created by

🇫🇷France pdureau Paris

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

Comments & Activities

Production build 0.71.5 2024