Bootstrap 5: Convert menu, breadcrumb and pagers to the links prop type

Created on 24 June 2023, about 1 year ago
Updated 7 December 2023, 7 months ago

Problem/Motivation

Let's leverage the new links setting type.

Remaining tasks

Dropdown: convert "Content"

Preparatory task before working on "Navbar nav".

By using a menu like structure for "content" slot, we will not need the dropdown_item component anymore:

  • if (item.title and item.url) condition: we render what was the dropdown_item variant
  • if (item.title and not item.url) condition:
    • if link_attributes has dropdown-header class: we render what was the dropdown_header variant
    • if link_attributes has dropdown-item class: we render what was the dropdown_item variant of button component.
    • else: we render what was the dropdown_item_text variant
  • if (not item.title and not item.url) condition OR link_attributes has dropdown-divider class: we render what was the dropdown_divider variant

Other tasks:

  • Add "heading_level" to dropdown component (it is OK to have the same level for all headings of a dropdown)
  • We also remove dropdown_item variant from button component
  • Remove test about "default" variant from template because doesn't exist in the definition.
  • Merge dropdown_tag into dropdown_navbar boolean props

(Navbar nav): convert "Menu items"

In order to be more themer friendly and be ready for SDC & UI Patterns 2.x, we need to remove PreprocessPatternNavbarNav

So, we are "resurrecting" 🐛 Bootstrap 5: dropdown is too complicated (outdated) Closed: outdated issue which was "aborted" because of compatibility problems with Menu Links Attributes : choosing which menu item is a dropdown divider, or text/header, or link, must stay possible from Drupal backoffice.

We will split the content of PreprocessPatternNavbarNav between:

  • LinksSettingType::normalize() : emptying the values of title and/or url properties according to Menu Links Attributes settings and routes. This change will be done in Add links setting type Needs review .
  • Dropdown component: now compatible thanks to the change we previously did previously with "content" slot

Heavy breaking changes. Careful with:

  • menu.html.twig (calling navbar_nav)
  • page.html.twig (calling navbar_nav)
  • navbar.ui_patterns.yml (calling navbar_nav)
  • nav.ui_patterns.yml (calling dropdown)

Other tasks:

  • Remove set dark = dark|default(false)?

We will not take the opportunity to merge navbar_nav into navbar.

Breadcrumb: convert Items

Straightforward. This change may be considered breaking but we doubt anybody is overriding breadcrumb.html.twig

See https://git.drupalcode.org/project/ui_suite_bootstrap/-/commit/1d766ee15...

Pagination: convert Pagination items

A bit more tricky, but still simple. This change may be considered breaking but we doubt anybody is overriding pager.html.twig and views-mini-pager.html.twig

See https://git.drupalcode.org/project/ui_suite_bootstrap/-/commit/1d766ee15...

📌 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

Merge Requests

Comments & Activities

Production build 0.69.0 2024