src/EcommerceBundle/PageBundle/DependencyInjection/EcommerceBundleSonataPageExtension.php
/**
     * Configure the page templates.
     *
     * @param ContainerBuilder $container Container builder
     * @param array            $config    Array of configuration
     */
Configure the page templates.
@param ContainerBuilder $container Container builder
@param array            $config    Array of configuration
Configure the page templates . @param ContainerBuilder $container Container builder @param array $config Array of configuration
public function configureTemplates(ContainerBuilder $container, array $config)
    {
        $templateManager = $container->getDefinition('sonata.page.template_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]);
        $templateManager->addMethodCall('setDefaultTemplateCode', [$config['default_template']]);
    }
public function configureTemplates ( ContainerBuilder $ container , array $ config ) { $ templateManager = $ container -> getDefinition ( 'sonata.page.template_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 ] ) ; $ templateManager -> addMethodCall ( 'setDefaultTemplateCode' , [ $ config [ 'default_template' ] ] ) ; }
Configure the page templates.
Configure the page templates .
// add all templates to manager // set default template