Download the PHP package zetta/menu-bundle without Composer
On this page you can find all versions of the php package zetta/menu-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zetta/menu-bundle
More information about zetta/menu-bundle
Files in zetta/menu-bundle
Package menu-bundle
Short Description Admin menu
License MIT
Homepage http://github.com/zetta/menuBundle
Informations about the package menu-bundle
ZettaMenuBundle
One Menu To Rule Them All
This bundle is an extension of KnpMenuBundle with which you can add a main menu for the system and this will be filtered depending on user role.
Features
- The menus can be set from the configuration file
app/config/config.yml
- The menu links are automatically filtered by the rules defined in the firewall
- JMSSecurityExtraBundle annotations are supported for creating the filter
- Integration with existing menus on your bundle thanks to the @SecureMenu annotation
Requirements
- PHP >=5.4
- KnpMenuBundle
- KnpMenu
- JMSSecurityExtraBundle
Installation
In order to install the bundle you need to add the dependency in composer.json
file.
Then you must register the bundle in the kernel of the application.
It is important that the ZettaMenuBundle statement is after KnpMenuBundle
Usage
There are two ways to filter our menus.
Simple way
If you use the simple method for creating menus
Simply add the annotation Zetta\MenuBundle\Annotation\SecureMenu
to the method to filter the items.
Configuration Method config.yml
We define a menu in the configuration file
Support KNP Menu Option
- attributes
- linkAttributes
- childrenAttributes
- labelAttributes
- extras
- displayChildren
Using the knp twig helper we can print it
By defailt if no deny rules exists in firewall or annotations the full menu will be printed
- Dashboard
- Users
- New User
- User Archive
- Catalogs
- Status
- Stats
In order to affect the menu render we start to define rules in our firewall
The system administrator can then see the full menu, however if a user authenticated with ROLE_USER can only view:
- Dashboard
- Usuarios
- Usuarios históricos
- Catálogos
- Status
Annotations
Assuming we have catalogs route defined in routing.yml
We add the annotation in the controller's method
The same user with ROLE_USER will see:
- Dashboard
- Usuarios
- Usuarios históricos
All versions of menu-bundle with dependencies
symfony/framework-bundle Version ~2
symfony/security-bundle Version ~2
knplabs/knp-menu Version ~2.0, >=2.0.0-beta1