AllowAllMenuPermissionChecker, which makes every item visible. To control item visibility — by Symfony role, feature flag, subscription, or any other rule — implement MenuPermissionCheckerInterface.
The interface
Implementing a checker
Create the class
Create a class in your
src/ directory and implement MenuPermissionCheckerInterface.src/Service/RoleMenuPermissionChecker.php
Setting a dashboard label
The label shown in the dashboard dropdown can be set in two ways:- Attribute (recommended)
- Class constant
Ordering and labelling via config
Usepermission_checker_choices to control the order of checkers in the dropdown, or to override their labels:
Assigning a checker to a menu
Checkers are assigned per menu in the dashboard. Open the configuration panel (gear icon) for any menu and choose a checker from the Permission checker dropdown. Leave it unset to use the default allow-all behaviour.How pruning works
When a checker hides an item, the bundle also removes any parent that has no visible children. This means:- A section (group header) with all children hidden is automatically removed.
- A link with all children hidden keeps itself but loses the subtree.
Built-in checkers
| Class | Behaviour |
|---|---|
AllowAllMenuPermissionChecker | Always returns true. Default when no checker is assigned. |
PermissionKeyAwareMenuPermissionChecker | Items without a permissionKey are visible; items with any key are hidden. Use as a structural reference or extend it for your own logic. |