spatie / menu

Html menu generator

Home Page:https://freek.dev/414-a-modern-package-to-generate-html-menus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

submenu rendenring only in a menu parts

Grummfy opened this issue · comments

Imagine we have a menu like this

root
  |_ A
    |_ A.1
    |_ A.2
      |_ A.2.1
  |_ C
    |_ C.1
  |_ D

We already detect with $menu->setActiveFromRequest or $menu->setActive the current active element in the menu. We should be able to see if we are on item "A.2.1" that A.2 is active (as parent) and A is active (as parent) too. But we can do more like non rendering item in C.1 because is in submenu not active at all.

So we can imagine to have a $menu->setActiveClassOnParent('css class for rendering parent menu from submenu') (pretty the same as setActiveClass). And a $menu->submenuIfActiveElement(...) (like$menu->submenuIf() but with condition that the child element must be selected or itself to be rendered)

I think it could be a nice improvements.