Pimcore Navigation Renderer Menu accept method does not check maxDepth


#1

Hey!

I am building my custom Foundation menu (also with custom design) and therefore stick to the example in the docs (https://pimcore.com/docs/5.x/Development_Documentation/Documents/Navigation.html#page_Using-Partials-Generating-a-Customized-Navigation) - except it’s build in Twig.

On pimcore_nav_renderer i am setting maxDepth(3).
{% set renderer = pimcore_nav_renderer('menu').setActiveClass('is-active').setUlClass('').setMaxDepth(3) %}

Your example uses {% for page in pages if renderer.accept(page) %}.
But renderer.accept() does not check the maxDepth. Only \Pimcore\Navigation\Renderer\Menu::_renderMenu does.

Is this a missing feature or do i miss something? Incomplete example in docs? Other tipps?

Currently i solved this by using a recursive macro with increasing a level var checking this against renderer.maxdepth but this is a little bit hacky :slight_smile:

Thanks!!