sokil / static-menu-bundle
Static menu bundle
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/sokil/static-menu-bundle
Requires
- php: ^5.6 || ^7.0
- knplabs/knp-menu-bundle: ~2
Requires (Dev)
- phpunit/phpunit: 5.4.*
- satooshi/php-coveralls: 1.0.*
This package is auto-updated.
Last update: 2023-04-14 00:47:57 UTC
README
Configure menus in symfony configuration file. This is wrapper over knp-menu-bundle
.
Installation
You can install bundle through Composer:
composer require sokil/static-menu-bundle
Add bundle to AppKernel:
<?php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // required dependencies new Knp\Bundle\MenuBundle\KnpMenuBundle(), // menu bundle new Sokil\StaticMenuBundle\StaticMenuBundle(), ); } }
Menu configuration
Configure menu in app/config/config.yml
static_menu: someMenuName: # set some name to your menu childrenAttributes: class: nav navbar-nav items: # configure items of menu - label: menu_tasks role: ROLE_TASK_VIEWER # role allowed to see menu uri: /#tasks - label: menu_contacts route: contact_us_index - label: menu_new_task uri: /#tasks/new role: IS_AUTHENTICATED_REMEMBERED linkAttributes: class: visible-xs
See item options at vendor/knplabs/knp-menu/src/Knp/Menu/Factory/CoreExtension.php
.
Menu rendering
KNP menus rendered by calling {{ knp_menu_render('static_menu.someMenuName') }}