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.

Comments

vbouchet created an issue. See original summary.

freelock’s picture

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.

alecsmrekar’s picture

heddn’s picture

Status: Active » Closed (won't fix)

Given https://www.drupal.org/project/group_content_menu_bundles as a possibility, I'm going to go out on a limb and suggest it is the solution desired here. If that isn't the case, feel free to re-open and provide some suggestions on how you'd like to see this move forward.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.