public function configureTemplates(ContainerBuilder $container, array $config)
    {
        $templateManager = $container->getDefinition('sonata.page.template_manager');

        // add all templates to manager
        $definitions = [];
        foreach ($config['templates'] as $code => $info) {
            $definition = new Definition(Template::class, [
                $info['name'],
                $info['path'],
                $info['containers'],
            ]);

            $definition->setPublic(false);
            $definitions[$code] = $definition;
        }

        $templateManager->addMethodCall('setAll', [$definitions]);

        // set default template
        $templateManager->addMethodCall('setDefaultTemplateCode', [$config['default_template']]);
    }