| 1 | <?php |
||
| 9 | class MenuProvider implements ServiceProviderInterface |
||
| 10 | { |
||
| 11 | public function register(Application $app) |
||
| 12 | { |
||
| 13 | $app['menu_builder'] = $app->share(function (Application $app) { |
||
| 14 | return new MenuBuilder( |
||
| 15 | $app['knp_menu.factory'], |
||
| 16 | $app['security.authorization_checker'], |
||
| 17 | $app['security.token_storage'], |
||
| 18 | $app['translator'] |
||
| 19 | ); |
||
| 20 | }); |
||
| 21 | |||
| 22 | $app['main_menu'] = function (Application $app) { |
||
| 23 | $menuBuilder = $app['menu_builder']; |
||
| 24 | /** @var MenuBuilder $menuBuilder */ |
||
| 25 | return $menuBuilder->buildMenu($app['request']); |
||
| 26 | }; |
||
| 27 | |||
| 28 | $knpMenuMenus = $app['knp_menu.menus']; |
||
| 29 | $knpMenuMenus['main'] = 'main_menu'; |
||
| 30 | $app['knp_menu.menus'] = $knpMenuMenus; |
||
| 31 | } |
||
| 32 | |||
| 33 | public function boot(Application $app) |
||
| 36 | } |
||
| 37 |