Integrate with menu_item_extras

Created on 15 October 2021, about 3 years ago
Updated 27 March 2024, 8 months ago

The menu_item_extras module kind of makes the menu items fieldable.

I would love to add some field to the menu items of a specific group menu. I am not really sure where / how to add the menu entries.

In admin > structure > group content menu types there is already "manage fields" and "manage [form] display" entries but these applies to the menu entities, not their menu items.
Given we want all the group menu of a same type to share the same menu item structure, we can't have these "manage *" entries at group level.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France vbouchet

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States freelock Seattle

    I've spent about 10 hours on this in the past couple days, and I don't think it's possible with the current entity types.

    I got quite far down this path -- I did manage to get the field ui showing up on individual group menus, content saving, and more -- which took patches all over the place, all in menu_item_extras.

    However, the final thing needed involves loading the bundle from the menu_link_content entity -- and I'm hitting a hard blocker here. Each entity type can define a single "Bundle Entity Type." This gets stored in the entity type definitions, and looked up directly in \Drupal\Core\Entity\EntityType->getBundleEntityType() -- and I don't see any way to override this to allow either "menu" or "group_content_menu" (or anything else) -- menu_item_extras sets this to "menu" in menu_item_extras_entity_type_build(), which stores it in the entity type definition -- and there's nowhere to change it before it gets loaded.

    If I remove the bundle_entity_type and add a provider instead, it doesn't load the bundle-specific field configs at all.

    So this looks like a hard blocker to making this work at all -- if the menu_link_content could set a bundle_entity_type to one of the entities in this module, I think the rest would fall into place -- but you can't get there from here! At least not with that entity type.

    I'm thinking the "correct" solution is to have group_content_menu module define its own menu_link_content entity -- can probably extend the original from core, and set the bundle entity type to the group_content_menu_type -- which would be far better than what I have, trying to jam it onto individual group_content_menus -- I don't see a reason the group_content_menu should be fieldable, I think it makes a lot more sense for the existing field_ui on the group_content_menu_type to apply to its menu_links, not the menu itself.

Production build 0.71.5 2024