Problem/Motivation

Goodmorning, thanks so much for this module!
The actual implementation gives the possibility to a user to add a menu item by a select but there is not the possibility to limit menus.
If user has not permissions to see menu items the select will show anyway all menu name.

Steps to reproduce

1. add a field_menu to an entity;
2. add or edit the entity content and search to a menu item from select
You will see all project menu name.

Proposed resolution

It could be interesting add a checkboxes list of menus on field settings and select which one to show.

I will add a first patch to add this feature, any suggestions is good!

Thanks so much!

CommentFileSizeAuthor
#4 limit-menu-to-show-3231522.patch2.94 KBenrico.sato

Comments

enrico.sato created an issue. See original summary.

enrico.sato’s picture

Issue summary: View changes
code-brighton’s picture

Hi Enrico,

great! I'm glad the module is proving useful!

Ok so the field settings would let the admin restrict which menus are available in the select list for a particular field_menu field.

Sounds good. Feel free to submit a patch and I'll review :)

enrico.sato’s picture

StatusFileSize
new2.94 KB

Hi Code, thanks so much for your reply!
Here a patch to add this feature. I tested also a scenario for an upgrade path and anything seems working well.

Let me know if anything is ok for you! Thanks!

mohit.bansal623’s picture

Hi Enrico.

Do you think checkboxes will be the solution, I think the design will not look good listing so many menus.

pierregermain’s picture

I have tested the patch, It's working.

code-brighton’s picture

Thanks @enrico.sato I've tested the patch. Works well. I've committed to the dev branch

code-brighton’s picture

Status: Active » Needs review

Changing status to needs review for now.

I'm happy with this and it's committed to the dev branch, but please feel free to give any feedback before I publish as a new release.

enrico.sato’s picture

Hi @code-brighton and @pierregermain, sorry for delay and thanks too much for check!
@mohit.bansal623 I didn't think about this scenario, any suggestions about this?
Thanks!

code-brighton’s picture

Hey @enrico.sato I was thinking it might be useful to have an option (checkbox?) to negate the condition so then you could e.g. exclude the Administration menu, which means menus added in the future would be included.

What do you think, do you want to add that functionality?

enrico.sato’s picture

Hi @code-brighton, sorry for delay! Yeah, your idea is really good. I will create a new patch asap to add this news feature.

Thanks so much for your feedback!

code-brighton’s picture

Status: Needs review » Fixed

@enrico.sato I've added your work and the negate option and released in the new 2.0.0 version. Many thanks again for your contribution

Status: Fixed » Closed (fixed)

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