The menu code resolver determines the effective menu code used to look up a menu from the database. The default resolver returns the hint unchanged — soDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nowo-tech/DashboardMenuBundle/llms.txt
Use this file to discover all available pages before exploring further.
dashboard_menu_tree('sidebar') always loads the menu with code sidebar.
Implement a custom resolver when you need to select different menu variants based on the current request, for example by operator ID, partner ID, or any other request attribute.
The interface
Implementing a resolver
The example below tries increasingly general menu codes, falling back to the plain hint when no specific variant exists:src/Service/MyMenuCodeResolver.php
Registering the resolver
Implement the interface
Create your class in
src/ and implement MenuCodeResolverInterface. Symfony auto-wires it through the normal service discovery.There is no
menu_code_resolver key in nowo_dashboard_menu.yaml. Registration is done entirely through the Symfony service container by replacing the MenuCodeResolverInterface alias.Where the resolver is used
The resolver runs on every menu load, in both Twig and the JSON API:| Caller | Example |
|---|---|
| Twig function | dashboard_menu_tree('sidebar') → resolver receives hint = 'sidebar' |
| JSON API | GET /api/menu/sidebar → resolver receives hint = 'sidebar' |
Default behaviour
DefaultMenuCodeResolver returns the hint unchanged: