Original request: Why not bundle per menu?

Usually, the different menu might have different fields, why do u think have a default bundle for all menu is a good idea.

Apart from the above, the ability to set the view mode on placing a menu block is the functionality missing in menu_item_extras, which is a huge plus for this module.

In order to have similar functionality as menu_item_extras that has different bundles per menu we can add the ability to configure a form mode per menu but keeping the ability to move menu items between menus.

Comments

weynhamz created an issue. See original summary.

rodrigoaguilera’s picture

Status: Active » Postponed (maintainer needs more info)

Since menu items can be moved between menus is complicated to change the bundle of an entity for this case. For example nodes can't change the content type.

If bundles is a useful feature to add to this module I think is better to separate it from the parent menu of an item since I feel is very useful to move items from one menu to another and it can get pretty confusing for the user to lose the content of the fields when that happens.

If different set of fields are needed for different menu items this module is not ready yet.

You can keep this issue open if you have a plan to work on implementing bundles.

rodrigoaguilera’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

I hope that was enough information

joshua.boltz’s picture

This module looked like a promising alternative to Menu Item Extras:
https://www.drupal.org/project/menu_item_extras

But the turn off with this module is that you need to add fields across all menus, so if you need to add a single, simple Text field or Image field to just one of your menus for some special use case, it's also added to all the other menus. What if you wanted fields A and B added to one menu, and fields C and D added to another menu?

I feel like it should be fieldable per menu. I think that is the thing that Menu Item Extras does good, but that module is over worked with how it deals with and overrides theme functions and templates, which makes it a bit more cumbersome to work with.

rodrigoaguilera’s picture

Status: Closed (works as designed) » Postponed (maintainer needs more info)

The analysis from my first comment was mostly a from a data structure point of view.
A compatible solution for this module would be to use different form modes per menu so the ability to move menu items will be preserved but you get different forms for each type of menu. The view mode can already be set with the module as is.

Does this solution sound good?

I am open to include it in the module (probably storing the form mode for each menu in the third party settings of the menu entity).
Then the swap of the form mode can be done in a hook like the one introduced in Drupal 9.2
https://www.drupal.org/node/3189884
I think the feature can be simple to code but I won't code it myself as I don't have the need for it yet.

rodrigoaguilera’s picture

BTW if bundles is the way to go I think the first step would be to expose the fieldability of menu items in Drupal core.
Please comment if you are interested: https://www.drupal.org/project/ideas/issues/3047131

justclint’s picture

@rodrigoaguilera, I also prefer this method of using form modes. If Im understanding this module correctly, we could in theory, have actual Menu "types" vs menu_item_extras where every menu has to manage its own fields and new menus cant reuse a set of predefined fields.

Ive installed the base and ui module and created custom menu link form modes but I do not see how to assign the form modes to specific menus as you mentioned in https://www.drupal.org/project/menu_item_fields/issues/3056830#comment-1...

How exactly are you assigning the form mode to specific menu's?

rodrigoaguilera’s picture

Title: Why not bundle per menu? » Add the ability to configure different form modes per menu
Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active

@justclint
I guess it depends on the use-case since having many "menu types" with different fields each can clutter the only bundle with fields that are not relevant, but it is great if you reuse fields form the different menu types.

The feature is not implemented yet so I updated the issue summary. I don't have the time to implement it now, but Merge requests are welcome

  • rodrigoaguilera committed 56ab1e8e on 8.x-1.x
    Issue #3056830: Add the ability to configure different form modes per...
rodrigoaguilera’s picture

Status: Active » Fixed

Forgot to close. Please open a new issue for the 2.0 version of the module if you want me to explain better how to use different form modes per-menu

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.