src/DependencyInjection/SonataFormatterExtension.php
/**
     * Loads the url shortener configuration.
     */
Loads the url shortener configuration.
Loads the url shortener configuration .
public function load(array $configs, ContainerBuilder $container): void
    {
        $processor = new Processor();
        $configuration = new Configuration();
        $config = $processor->processConfiguration($configuration, $configs);
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('formatter.xml');
        $loader->load('twig.xml');
        $loader->load('validators.xml');
        $bundles = $container->getParameter('kernel.bundles');
        if (isset($bundles['FOSCKEditorBundle'])) {
            if (interface_exists(CKEditorConfigurationInterface::class)) {
                $loader->load('form.xml');
            } else {
                $loader->load('form_fcke1.xml');
            }
        }
        if (isset($bundles['SonataBlockBundle'])) {
            $loader->load('block.xml');
        }
        if (isset($bundles['SonataMediaBundle'])) {
            $loader->load('ckeditor.xml');
        }
        if (!\array_key_exists($config['default_formatter'], $config['formatters'])) {
            throw new \InvalidArgumentException(sprintf(
                'SonataFormatterBundle - Invalid default formatter: %s, available: %s',
                $config['default_formatter'],
                sprintf('["%s"]', implode('", "', array_keys($config['formatters'])))
            ));
        }
        $pool = $container->getDefinition('sonata.formatter.pool');
        $pool->addArgument($config['default_formatter']);
        foreach ($config['formatters'] as $code => $configuration) {
            if (0 === \count($configuration['extensions'])) {
                $env = null;
            } else {
                $env = new Reference($this->createEnvironment(
                    $container,
                    $code,
                    $configuration['extensions']
                ));
            }
            $pool->addMethodCall(
                'add',
                [$code, new Reference($configuration['service']), $env]
            );
        }
        $container->setParameter(
            'sonata.formatter.ckeditor.configuration.templates',
            $config['ckeditor']['templates']
        );
    }
public function load ( array $ configs , ContainerBuilder $ container ) : void { $ processor = new Processor ( ) ; $ configuration = new Configuration ( ) ; $ config = $ processor -> processConfiguration ( $ configuration , $ configs ) ; $ loader = new XmlFileLoader ( $ container , new FileLocator ( __DIR__ . '/../Resources/config' ) ) ; $ loader -> load ( 'formatter.xml' ) ; $ loader -> load ( 'twig.xml' ) ; $ loader -> load ( 'validators.xml' ) ; $ bundles = $ container -> getParameter ( 'kernel.bundles' ) ; if ( isset ( $ bundles [ 'FOSCKEditorBundle' ] ) ) { if ( interface_exists ( CKEditorConfigurationInterface :: class ) ) { $ loader -> load ( 'form.xml' ) ; } else { $ loader -> load ( 'form_fcke1.xml' ) ; } } if ( isset ( $ bundles [ 'SonataBlockBundle' ] ) ) { $ loader -> load ( 'block.xml' ) ; } if ( isset ( $ bundles [ 'SonataMediaBundle' ] ) ) { $ loader -> load ( 'ckeditor.xml' ) ; } if ( ! \ array_key_exists ( $ config [ 'default_formatter' ] , $ config [ 'formatters' ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'SonataFormatterBundle - Invalid default formatter: %s, available: %s' , $ config [ 'default_formatter' ] , sprintf ( '["%s"]' , implode ( '", "' , array_keys ( $ config [ 'formatters' ] ) ) ) ) ) ; } $ pool = $ container -> getDefinition ( 'sonata.formatter.pool' ) ; $ pool -> addArgument ( $ config [ 'default_formatter' ] ) ; foreach ( $ config [ 'formatters' ] as $ code => $ configuration ) { if ( 0 === \ count ( $ configuration [ 'extensions' ] ) ) { $ env = null ; } else { $ env = new Reference ( $ this -> createEnvironment ( $ container , $ code , $ configuration [ 'extensions' ] ) ) ; } $ pool -> addMethodCall ( 'add' , [ $ code , new Reference ( $ configuration [ 'service' ] ) , $ env ] ) ; } $ container -> setParameter ( 'sonata.formatter.ckeditor.configuration.templates' , $ config [ 'ckeditor' ] [ 'templates' ] ) ; }
Loads the url shortener configuration.
Loads the url shortener configuration .
//NEXT_MAJOR: Remove this case