Download the PHP package zerkalica/millwright-menu-bundle without Composer
On this page you can find all versions of the php package zerkalica/millwright-menu-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zerkalica/millwright-menu-bundle
More information about zerkalica/millwright-menu-bundle
Files in zerkalica/millwright-menu-bundle
Package millwright-menu-bundle
Short Description Config abstraction for knp menu bundle
License
Informations about the package millwright-menu-bundle
Using menus with MillwrightMenuBundle
MillwrightMenuBundle extends base functionality of KnpMenuBundle and adds configuration, route, translation and security context support. Each link on the site is a part of configured menu container, which supports translation, role and acl-based security, route params.
Basic Docs
- Features
- Installation
- Creating menus
- Using annotations
- Using menu in templates
- Menu item options
Features
-
It uses
JMSSecurityExtraBundleannotations for configuring menu items visibility: role-based and acl-based security context support -
Menu options consist of two parts:
itemsdescribes each menu item: labels, route|uri, translate, roletreedescribes each menu container as hierarchy of menu items
-
itemscan be configured from config file and annotations in controller class and actions -
We can juggle any configured menu items in containers
-
Menu twig helper supports route parameters, needed for changing menu items visibility on demand, based on acl
- Menu options merged from multiple sources:
treesection of config,itemsection,@Menuannotations in action method,@Menuannotation in controller class
Installation
Step 1) Composer
Require the bundle through composer
Step 2) Register the bundle
To start using the bundle, register it in your Kernel:
Step 3) Configure knp bundle
Creating menus
Any bundle can provide own menu or modify existing through millwright_menu.menu_options tagged service:
order attribute - order of provided menu.
First parameter is the collection of menu options.
By default one menu provided by MillwrightMenuBundle and configured in millwright_menu section of the application config.
Using annotations
Items section can be configured from annotations:
Using menu in templates
millwright_menu_render supports additional route parameters, the other options are equivalent to knp_menu_render.
Simpe usage
Advanced
We have a user collection, each user has acl permissions
Menu item options
items section:
<key>- used as default value for name, route and labeluri- uri string, if no route parameter setlabel- label text or translation string templatename- name of menu item, used as default for routeattributes- knp menu item optionslinkAttributes- knp menu item optionschildrenAttributes- knp menu item optionslabelAttributes- knp menu item optionsdisplay- knp menu item optionsdisplayChildren- knp menu item optionstranslateDomain- translation domaintranslateParameters- translation parameterssecureParams- copy of@SecureParamJMSSecurityExtraBundleannotationsroles- copy of@SecureJMSSecurityExtraBundleannotationroute- route name for uri generation, if not set and uri not set - loads from keyrouteAbsolute- true for absolute url generationshowNonAuthorized- show for non-authorized usersshowAsText- if authorized and no access to item, show item as texticon- icon class for menu item
tree section:
type- menu container typechildren- submenu items
renderers section:
<menu type>- menu container typerenderer- custom rendererrendererOptions- options pass to menu renderer: template, etc
Annotation options
@Menu annotation supports: label, translateDomain, translateParameters, name, showNonAuthorized, showAsText options.
Example
//@todo sandbox
Menu file: