Selection of menu when adding a group menu block

Created on 17 October 2024, about 1 month ago

Problem/Motivation

As of now, the group menu block plugin always loads the first menu of a group menu bundle and renders that in the block (see \Drupal\group_content_menu\Plugin\Block\GroupMenuBlock::getMenuInstance() line 346). So in order to add a block showing another menu, the only way requires these steps currently:

  1. adding another group menu content type
  2. enabling the group menu content type’s relationship in the site group settings
  3. If the block should be added to layouts: enable the menu content type in the allowed group menu block of the page content type’s display (layout builder) settings.

Adding another block that shows any other menu than the first menu of the same group menu content type is not possible.

This would save going through the above steps every time we want to add a new menu to the sidebar.

Steps to reproduce

  • Create a group menu content type
  • Create 2 menus of that content type
  • Add a group menu block in layout builder or the general block layout

Observe that it's not possible to add a block for the second menu.

Proposed resolution

It would be better to add a dropdown to the menu group block form which will allow selecting a menu of that group menu content type and then render the selected menu instead.

Remaining tasks

User interface changes

Dropdown for menu selection on the block form

API changes

Data model changes

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024