src/DependencyInjection/KnpMenuExtension.php
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('menu.xml');

        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        foreach ($config['providers'] as $builder => $enabled) {
            if ($enabled) {
                $container->getDefinition(sprintf('knp_menu.menu_provider.%s', $builder))->addTag('knp_menu.provider');
            }
        }

        if (isset($config['twig'])) {
            $loader->load('twig.xml');
            $container->setParameter('knp_menu.renderer.twig.template', $config['twig']['template']);
        }
        if ($config['templating']) {
            $loader->load('templating.xml');
        }

        $container->setParameter('knp_menu.default_renderer', $config['default_renderer']);

        // Register autoconfiguration rules for Symfony DI 3.3+
        if (method_exists($container, 'registerForAutoconfiguration')) {
            $container->registerForAutoconfiguration(VoterInterface::class)
                ->addTag('knp_menu.voter');
        }
    }
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('menu.xml');

        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        foreach ($config['providers'] as $builder => $enabled) {
            if ($enabled) {
                $container->getDefinition(sprintf('knp_menu.menu_provider.%s', $builder))->addTag('knp_menu.provider');
            }
        }

        if (isset($config['twig'])) {
            $loader->load('twig.xml');
            $container->setParameter('knp_menu.renderer.twig.template', $config['twig']['template']);
        }
        if ($config['templating']) {
            $loader->load('templating.xml');
        }

        $container->setParameter('knp_menu.default_renderer', $config['default_renderer']);

        // Register autoconfiguration rules for Symfony DI 3.3+
        if (method_exists($container, 'registerForAutoconfiguration')) {
            $container->registerForAutoconfiguration(VoterInterface::class)
                ->addTag('knp_menu.voter');
        }
    }
public function load ( array $ configs , ContainerBuilder $ container ) { $ loader = new XmlFileLoader ( $ container , new FileLocator ( __DIR__ . '/../Resources/config' ) ) ; $ loader -> load ( 'menu.xml' ) ; $ configuration = new Configuration ( ) ; $ config = $ this -> processConfiguration ( $ configuration , $ configs ) ; foreach ( $ config [ 'providers' ] as $ builder => $ enabled ) { if ( $ enabled ) { $ container -> getDefinition ( sprintf ( 'knp_menu.menu_provider.%s' , $ builder ) ) -> addTag ( 'knp_menu.provider' ) ; } } if ( isset ( $ config [ 'twig' ] ) ) { $ loader -> load ( 'twig.xml' ) ; $ container -> setParameter ( 'knp_menu.renderer.twig.template' , $ config [ 'twig' ] [ 'template' ] ) ; } if ( $ config [ 'templating' ] ) { $ loader -> load ( 'templating.xml' ) ; } $ container -> setParameter ( 'knp_menu.default_renderer' , $ config [ 'default_renderer' ] ) ; // Register autoconfiguration rules for Symfony DI 3.3+ if ( method_exists ( $ container , 'registerForAutoconfiguration' ) ) { $ container -> registerForAutoconfiguration ( VoterInterface :: class ) -> addTag ( 'knp_menu.voter' ) ; } }
Handles the knp_menu configuration.

@param array            $configs   The configurations being loaded
@param ContainerBuilder $container
Handles the knp_menu configuration .