caffeinated / menus

:pushpin: Menu generator package for the Laravel framework
https://caffeinatedpackages.com
132 stars 59 forks source link

After filtering menu items, have a clean-up to eliminate empty submenus? #30

Closed AlexRegenbogen closed 9 years ago

AlexRegenbogen commented 9 years ago

After using a similar approach as stated in https://github.com/caffeinated/menus/issues/26, I'm now one step away from my desired solution.... ;-)

If there are items that are not allowed, they will be removed from the navigation, but any remaining submenus that no longer have any items, are still displayed....

Would be very nice to have some sort of clean-up possibility to remove all items without children and without an link.

kaidesu commented 9 years ago

Would that not be something the developer should handle for their specific use-case when filtering?

AlexRegenbogen commented 9 years ago

The more I think about it, the more I feel like that's the right answer ;-)

Solved it by adding the clean-up in MyMenu in the make method before passing $menu along to the view...

kaidesu commented 9 years ago

:+1: