how to get previous and next menu item in knp menu?

315 Views Asked by At

I am using knp menu bundle to generate tree menu. How do I get previous and next menu item (to navigate to previous and next post like in blog) with respect to current opened page ?

1

There are 1 best solutions below

2
Rvanlaak On

As menu items extend ArrayAccess you can get the previous/next item the same way as you'd do with a regular array.

You can make use of array_search to locate the key.