src/Event/Subscriber/MenuSubscriber.php
public function buildMenus(MenuEvent $event)
    {
        if (!$this->applicationConfiguration->getParameter('enable_menus')) {
            return;
        }
        $menuConfigurations = array_merge_recursive(
            $this->adminMenuConfigurations,
            $event->getMenuConfigurations()
        );
        $configurationEvent = new MenuConfigurationEvent($menuConfigurations);

        // Dispatch a pre-menu build event to allow dynamic configuration modifications
        $this
            ->eventDispatcher
            ->dispatch(Events::MENU_CONFIGURATION, $configurationEvent)
        ;
        $menuConfigurations = $configurationEvent->getMenuConfigurations();

        foreach ($menuConfigurations as $name => $menuConfiguration) {
            $this->menuFactory->create($name, $menuConfiguration);
        }
    }
public function buildMenus(MenuEvent $event)
    {
        if (!$this->applicationConfiguration->getParameter('enable_menus')) {
            return;
        }
        $menuConfigurations = array_merge_recursive(
            $this->adminMenuConfigurations,
            $event->getMenuConfigurations()
        );
        $configurationEvent = new MenuConfigurationEvent($menuConfigurations);

        // Dispatch a pre-menu build event to allow dynamic configuration modifications
        $this
            ->eventDispatcher
            ->dispatch(Events::MENU_CONFIGURATION, $configurationEvent)
        ;
        $menuConfigurations = $configurationEvent->getMenuConfigurations();

        foreach ($menuConfigurations as $name => $menuConfiguration) {
            $this->menuFactory->create($name, $menuConfiguration);
        }
    }
public function buildMenus ( MenuEvent $ event ) { if ( ! $ this -> applicationConfiguration -> getParameter ( 'enable_menus' ) ) { return ; } $ menuConfigurations = array_merge_recursive ( $ this -> adminMenuConfigurations , $ event -> getMenuConfigurations ( ) ) ; $ configurationEvent = new MenuConfigurationEvent ( $ menuConfigurations ) ; // Dispatch a pre-menu build event to allow dynamic configuration modifications $ this -> eventDispatcher -> dispatch ( Events :: MENU_CONFIGURATION , $ configurationEvent ) ; $ menuConfigurations = $ configurationEvent -> getMenuConfigurations ( ) ; foreach ( $ menuConfigurations as $ name => $ menuConfiguration ) { $ this -> menuFactory -> create ( $ name , $ menuConfiguration ) ; } }
Build menus according to the given configuration.

@param MenuEvent $event
Build menus according to the given configuration .