I'm developing a custom theme using sub-theme just for learning purpose. In custom theme, I have added a custom block in which I need to display main menus' sub items if in_active_trail. I have already tried many times and wasted a lot time but unsuccessful.
- Block should display when Level 1 is in_active_trails and it has child(s).
- Block should not display when Level 1 in_active_trails but it has no child.
- If any Level 2 is current page, display Level 2 and 3 menu items expect level 1.
- Same as point 3, if Level 3 is current page then display level 3 and 2 items.
See attached image below for more understanding what I want to do.
Main Menu hierarchy