MenuSource item url property

Created on 17 January 2025, 4 days ago

I had a working menu template, that I am converting to use as an SDC.

I'm finding that the way links are structured in the menu template are different.

Is this intentional, or are we missing a preprocess for that?

This screenshot shows the url property for menu links. The menu above is a menu SDC using MenuSource. The menu below is with Menu Block, but should be the same as regular menu blocks here.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

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

Comments & Activities

  • Issue created by @mortona2k
  • πŸ‡«πŸ‡·France pdureau Paris

    The Links prop type is an abstract data structure made to be able to "host" many Drupal data sttucture (menu, links, pager, breadcrumb...)

    It is normal the structure is a bit different before after the normalization: https://git.drupalcode.org/project/ui_patterns/-/blob/2.0.x/src/Plugin/U...

    We hope this work will be done by Drupal Core in the future: ✨ Add unified Links data type for menus, pagers, breadcrumbs... Active

  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    The main issue I encountered is that the url is a string instead of an object.

    To print it in the template took extra checks and manipulation to handle the 3 different link urls.

  • πŸ‡«πŸ‡·France pdureau Paris

    The main issue I encountered is that the url is a string instead of an object.

    It was done in purpose. Everything related to the application state must be resolved before being sent to component template. SDC templates must be dumb, UI-logic only.

    To print it in the template took extra checks and manipulation to handle the 3 different link urls.

    Are you sure you need those checks to implement an UI component like DaisyUI's footer? I guess not :)

    If yes, we can talk about changing LinksPropType::normalize() logic.

Production build 0.71.5 2024