Adds semantic configuration definition.

@param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
768275
public function addSemanticConfig(NodeBuilder $nodeBuilder)
    {
        $nodeBuilder
            ->scalarNode('repository')->info('The repository to use. Choose among ezpublish.repositories.')->end()
            // @deprecated
            // Use ezpublish.repositories / repository settings instead.
            ->arrayNode('database')
                ->info('DEPRECATED. Use ezpublish.repositories / repository settings instead.')
                ->children()
                    ->enumNode('type')->values(array('mysql', 'pgsql', 'sqlite'))->info('The database driver. Can be mysql, pgsql or sqlite.')->end()
                    ->scalarNode('server')->end()
                    ->scalarNode('port')->end()
                    ->scalarNode('user')->cannotBeEmpty()->end()
                    ->scalarNode('password')->end()
                    ->scalarNode('database_name')->cannotBeEmpty()->end()
                    ->scalarNode('charset')->defaultValue('utf8')->end()
                    ->scalarNode('socket')->end()
                    ->arrayNode('options')
                        ->info('Arbitrary options, supported by your DB driver ("driver-opts" in PDO)')
                        ->example(array('foo' => 'bar', 'someOptionName' => array('one', 'two', 'three')))
                        ->useAttributeAsKey('key')
                        ->prototype('variable')->end()
                    ->end()
                    ->scalarNode('dsn')->info('Full database DSN. Will replace settings above.')->example('mysql://root:root@localhost:3306/ezdemo')->end()
                ->end()
            ->end()
            ->scalarNode('cache_service_name')
                ->example('cache.app')
                ->info('The cache pool service name to use for a siteaccess / siteaccess-group, *must* be present.')
            ->end()
            ->scalarNode('var_dir')
                ->cannotBeEmpty()
                ->example('var/ezdemo_site')
                ->info('The directory relative to web/ where files are stored. Default value is "var"')
            ->end()
            ->arrayNode('api_keys')
                ->info('Collection of API keys')
                ->addDefaultsIfNotSet()
                ->children()
                    ->scalarNode('google_maps')
                        ->setDeprecated('The child node "%node%" at path "%path%" is no longer used and deprecated.')
                        ->info('Google Maps API Key, required as of Google Maps v3 to make sure maps show up correctly.')
                    ->end()
                ->end()
            ->end()
            ->scalarNode('storage_dir')
                ->cannotBeEmpty()
                ->info("Directory where to place new files for storage, it's relative to var directory. Default value is 'storage'")
            ->end()
            ->scalarNode('binary_dir')
                ->cannotBeEmpty()
                ->info('Directory where binary files (from ezbinaryfile field type) are stored. Default value is "original"')
            ->end()
            // @deprecated since 5.3. Will be removed in 6.x.
            ->scalarNode('session_name')
                ->info('DEPRECATED. Use session.name instead.')
            ->end()
            ->arrayNode('session')
                ->info('Session options. Will override options defined in Symfony framework.session.*')
                ->children()
                    ->scalarNode('name')
                        ->info('The session name. If you want a session name per siteaccess, use "{siteaccess_hash}" token. Will override default session name from framework.session.name')
                        ->example(array('session' => array('name' => 'eZSESSID{siteaccess_hash}')))
                    ->end()
                    ->scalarNode('cookie_lifetime')->end()
                    ->scalarNode('cookie_path')->end()
                    ->scalarNode('cookie_domain')->end()
                    ->booleanNode('cookie_secure')->end()
                    ->booleanNode('cookie_httponly')->end()
                ->end()
            ->end()
            ->scalarNode('pagelayout')
                ->info('The default layout to use')
                ->example('AppBundle::pagelayout.html.twig')
            ->end()
            ->scalarNode('index_page')
                ->info('The page that the index page will show. Default value is null.')
                ->example('/Getting-Started')
            ->end()
            ->scalarNode('default_page')
                ->info('The default page to show, e.g. after user login this will be used for default redirection. If provided, will override "default_target_path" from security.yml.')
                ->example('/Getting-Started')
            ->end()
            ->arrayNode('http_cache')
                ->info('Settings related to Http cache')
                ->children()
                    ->arrayNode('purge_servers')
                        ->info('Servers to use for Http PURGE (will NOT be used if ezpublish.http_cache.purge_type is "local").')
                        ->example(array('http://localhost/', 'http://another.server/'))
                        ->requiresAtLeastOneElement()
                        ->prototype('scalar')->end()
                    ->end()
                ->end()
            ->end()
            ->scalarNode('anonymous_user_id')
                ->cannotBeEmpty()
                ->example('10')
                ->info('The ID of the user used for everyone who is not logged in.')
            ->end()
            ->arrayNode('user')
                ->children()
                    ->scalarNode('layout')
                        ->info('Layout template to use for user related actions. This is most likely the base pagelayout template of your site.')
                        ->example(array('layout' => 'eZDemoBundle::pagelayout.html.twig'))
                    ->end()
                    ->scalarNode('login_template')
                        ->info('Template to use for login form. Defaults to EzPublishCoreBundle:security:login.html.twig')
                        ->example(array('login_template' => 'AcmeTestBundle:User:login.html.twig'))
                    ->end()
                ->end()
            ->end();
    }
902483
private function prependEzDesignSettings(ContainerBuilder $containerBuilder)
    {
        $configFile = __DIR__ . '/../Resources/config/extension/ezdesign.yaml';
        $config = Yaml::parseFile($configFile);
        $containerBuilder->prependExtensionConfig('ezdesign', $config);
        $containerBuilder->addResource(new FileResource($configFile));
    }
1022388
private function loadConfigFiles(ContainerBuilder $container): void
    {
        $loader = new YamlFileLoader(
            $container,
            new FileLocator(__DIR__ . '/../Resources/config')
        );

        $loader->load('default_settings.yml');
        $loader->load('services/errors.yml');
        $loader->load('services/view/providers.yml');
        $loader->load('services/view/matchers.yml');
        $loader->load('services/view/view.yml');

        $loader->load('services/items.yml');
        $loader->load('services/block_definitions.yml');
        $loader->load('services/config_definitions.yml');
        $loader->load('services/forms.yml');
        $loader->load('services/context.yml');
        $loader->load('services/commands.yml');
        $loader->load('services/design.yml');
        $loader->load('services/security.yml');
        $loader->load('services/utils.yml');

        $loader->load('services/layout_resolver/layout_resolver.yml');
        $loader->load('services/layout_resolver/condition_types.yml');
        $loader->load('services/layout_resolver/target_handlers.yml');
        $loader->load('services/layout_resolver/target_types.yml');
        $loader->load('services/layout_resolver/forms.yml');

        $loader->load('browser/services.yml');
        $loader->load('services/layouts.yml');
        $loader->load('services/collections.yml');
        $loader->load('services/param_converters.yml');
        $loader->load('services/event_listeners.yml');

        $loader->load('services/configuration.yml');
        $loader->load('services/controllers.yml');
        $loader->load('services/normalizers.yml');
        $loader->load('services/validators.yml');
        $loader->load('services/templating.yml');
        $loader->load('services/parameters.yml');
        $loader->load('services/http_cache.yml');
        $loader->load('services/locale.yml');

        $loader->load('services/transfer/serialization_visitors.yml');
        $loader->load('services/transfer/services.yml');

        $loader->load('services/api.yml');
    }
596951
public function getConfigTreeBuilder(): TreeBuilder
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('dms_filter');

        $rootNode->children()->booleanNode('auto_filter_forms')->defaultValue(true);

        // Here you should define the parameters that are allowed to
        // configure your bundle. See the documentation linked above for
        // more information on that topic.

        return $treeBuilder;
    }
569843
protected function defineAttributes(NodeBuilder $builder)
    {
        $builder->arrayNode('attributes')
            ->useAttributeAsKey('')
            ->prototype('array')
            ->children()

            ->scalarNode('type')
                ->cannotBeEmpty()
            ->end()

            ->scalarNode('getter')
                ->cannotBeEmpty()
            ->end()

            ->scalarNode('setter')
                ->cannotBeEmpty()
            ->end()

            ->booleanNode('processNull')
                ->defaultFalse()
            ->end();
    }
465013
protected function loadConfiguration(ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . "/../Config/Resources"));
        $finder = Finder::create()
            ->name('*.xml')
            ->depth(0)
            ->in(__DIR__ . "/../Config/Resources");

        /** @var \SplFileInfo $file */
        foreach ($finder as $file) {
            $loader->load($file->getBaseName());
        }

        if (\defined("THELIA_INSTALL_MODE") === false) {
            $modules = ModuleQuery::getActivated();

            $translationDirs = array();



            /** @var Module $module */
            foreach ($modules as $module) {
                try {
                    $definition = new Definition();
                    $definition->setClass($module->getFullNamespace());
                    $definition->addMethodCall("setContainer", array(new Reference('service_container')));

                    $container->setDefinition(
                        "module." . $module->getCode(),
                        $definition
                    );

                    $compilers = \call_user_func(array($module->getFullNamespace(), 'getCompilers'));

                    foreach ($compilers as $compiler) {
                        if (\is_array($compiler)) {
                            $container->addCompilerPass($compiler[0], $compiler[1]);
                        } else {
                            $container->addCompilerPass($compiler);
                        }
                    }

                    $loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath()));
                    $loader->load("config.xml", "module." . $module->getCode());

                    $envConfigFileName = sprintf("config_%s.xml", $this->environment);
                    $envConfigFile = sprintf('%s%s%s', $module->getAbsoluteConfigPath(), DS, $envConfigFileName);

                    if (is_file($envConfigFile) && is_readable($envConfigFile)) {
                        $loader->load($envConfigFileName, "module." . $module->getCode());
                    }
                } catch (\Exception $e) {
                    Tlog::getInstance()->addError(
                        sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()),
                        $e
                    );
                }
            }

            $parser = $container->getDefinition('thelia.parser');

            /** @var \Thelia\Core\Template\TemplateHelperInterface $templateHelper */
            $templateHelper = $container->get('thelia.template_helper');

            /** @var Module $module */
            foreach ($modules as $module) {
                try {
                    $this->loadModuleTranslationDirectories($module, $translationDirs, $templateHelper);

                    $this->addStandardModuleTemplatesToParserEnvironment($parser, $module);
                } catch (\Exception $e) {
                    Tlog::getInstance()->addError(
                        sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()),
                        $e
                    );
                }
            }

            // Load core translation
            $translationDirs['core'] = THELIA_LIB . 'Config' . DS . 'I18n';

            // Load core translation
            $translationDirs[Translator::GLOBAL_FALLBACK_DOMAIN] = THELIA_LOCAL_DIR . 'I18n';

            // Standard templates (front, back, pdf, mail)
            /** @var TemplateDefinition $templateDefinition */
            foreach ($templateHelper->getStandardTemplateDefinitions() as $templateDefinition) {
                // Load parent templates transaltions, the current template translations.
                $templateList = array_merge(
                    $templateDefinition->getParentList(),
                    [ $templateDefinition ]
                );

                /** @var TemplateDefinition $tplDef */
                foreach ($templateList as $tplDef) {
                    if (is_dir($dir = $tplDef->getAbsoluteI18nPath())) {
                        $translationDirs[$tplDef->getTranslationDomain()] = $dir;
                    }
                }
            }

            if ($translationDirs) {
                $this->loadTranslation($container, $translationDirs);
            }
        }
    }
202034
private function addNodeJSConfiguration(NodeBuilder $node)
    {
        $node
            ->arrayNode('node')
            ->addDefaultsIfNotSet()
            ->children()
                ->arrayNode('binary')
                    ->addDefaultsIfNotSet()
                    ->beforeNormalization()
                    ->ifString()
                        ->then(function ($value) {
                            return [
                                'win32'     => $value,
                                'win64'     => $value,
                                'linux_x32' => $value,
                                'linux_x64' => $value,
                                'darwin'    => $value,
                                'fallback'  => $value,
                            ];
                        })
                    ->end()
                    ->children()
                        ->scalarNode('win32')->defaultValue('node')->end()
                        ->scalarNode('win64')->defaultValue('node')->end()
                        ->scalarNode('linux_x32')->defaultValue('node')->end()
                        ->scalarNode('linux_x64')->defaultValue('node')->end()
                        ->scalarNode('darwin')->defaultValue('node')->end()
                        ->scalarNode('fallback')->defaultValue('node')->end()
                    ->end()
                ->end()
                ->scalarNode('npm_packages_path')->defaultNull()->end()
                ->scalarNode('node_modules_path')->defaultNull()->end()
            ->end();
    }
857260
public function addSemanticConfig(NodeBuilder $nodeBuilder)
    {
        $nodeBuilder
            ->arrayNode(static::NODE_KEY)
                ->info(static::INFO)
                ->useAttributeAsKey('key')
                ->normalizeKeys(false)
                ->prototype('array')
                    ->useAttributeAsKey('key')
                    ->normalizeKeys(false)
                    ->info("View selection rulesets, grouped by view type. Key is the view type (e.g. 'full', 'line', ...)")
                    ->prototype('array')
                        ->children()
                            ->scalarNode('template')->info('Your template path, as MyBundle:subdir:my_template.html.twig')->end()
                            ->scalarNode('controller')
                                ->info(
<<<EOT
Use custom controller instead of the default one to display a content matching your rules.
You can use the controller reference notation supported by Symfony.
EOT
                                )
                                ->example('MyBundle:MyControllerClass:view')
                            ->end()
                            ->arrayNode('match')
                                ->info('Condition matchers configuration')
                                ->isRequired()
                                ->useAttributeAsKey('key')
                                ->prototype('variable')->end()
                            ->end()
                            ->append($this->getQueryNode(static::QUERY_KEY))
                            ->arrayNode('params')
                                ->info(
<<<EOT
Arbitrary params that will be passed in the ContentView object, manageable by ViewProviders.
Those params will NOT be passed to the resulting view template by default.
EOT
                                )
                                ->example(
                                    [
                                        'foo' => '%some.parameter.reference%',
                                        'osTypes' => ['osx', 'linux', 'windows'],
                                    ]
                                )
                                ->useAttributeAsKey('key')
                                ->prototype('variable')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }
947682
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder('knp_markdown');
        // BC layer for symfony/config < 4.2
        $rootNode = method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('knp_markdown');

        $rootNode
            ->addDefaultsIfNotSet()
            ->children()
                ->arrayNode('parser')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('service')->cannotBeEmpty()->defaultValue('markdown.parser.max')->end()
                    ->end()
                ->end()
                ->arrayNode('sundown')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('extensions')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->booleanNode('fenced_code_blocks')->defaultFalse()->end()
                                ->booleanNode('no_intra_emphasis')->defaultFalse()->end()
                                ->booleanNode('tables')->defaultFalse()->end()
                                ->booleanNode('autolink')->defaultFalse()->end()
                                ->booleanNode('strikethrough')->defaultFalse()->end()
                                ->booleanNode('lax_html_blocks')->defaultFalse()->end()
                                ->booleanNode('space_after_headers')->defaultFalse()->end()
                                ->booleanNode('superscript')->defaultFalse()->end()
                            ->end()
                        ->end()
                        ->arrayNode('render_flags')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->booleanNode('filter_html')->defaultFalse()->end()
                                ->booleanNode('no_images')->defaultFalse()->end()
                                ->booleanNode('no_links')->defaultFalse()->end()
                                ->booleanNode('no_styles')->defaultFalse()->end()
                                ->booleanNode('safe_links_only')->defaultFalse()->end()
                                ->booleanNode('with_toc_data')->defaultFalse()->end()
                                ->booleanNode('hard_wrap')->defaultFalse()->end()
                                ->booleanNode('xhtml')->defaultFalse()->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ->end();

        return $treeBuilder;
    }
963924
public function defineFormBuilder(FormBuilderInterface $formBuilder)
    {
        /** @var AbstractAdmin $admin */
        $admin = $this;

        $mapper = new \Compo\Sonata\AdminBundle\Form\FormMapper($admin->getFormContractor(), $formBuilder, $admin);

        $this->configureFormFields($mapper);

        foreach ($admin->getExtensions() as $extension) {
            $extension->configureFormFields($mapper);
        }

        $this->attachInlineValidator();
    }
1014013
protected function getRootDefinition(TreeBuilder $treeBuilder): ArrayNodeDefinition
    {
        /** @var ArrayNodeDefinition $rootNode */
        $rootNode = $treeBuilder->root('root');
        $rootNode->ignoreExtraKeys(false);

        // @formatter:off
        $rootNode
            ->children()
                ->append($this->getParametersDefinition());
        // @formatter:on

        return $rootNode;
    }
1203118
public function getConfigTreeBuilder()
    {
        $node = $this->getRootNode();
        $node = $node->children();
        $node = $this->getChildren($node);
        $node = $node->end();

        return $node;
    }
353933
protected function instantiationOptions(SchemaBuilder $builder)
    {
        if ($this->getInstantiator() != DocumentInstantiator::class) {
            //Unable to define options for non default inheritance based instantiator
            return null;
        }

        //Let's define a way how to separate one model from another based on given fields
        $helper = new InheritanceHelper($this, $builder->getSchemas());

        return $helper->makeDefinition();
    }
1089398
protected function appendFieldDefinition(NodeBuilder $fieldDefinition): void
    {
        $fieldDefinition
            ->scalarNode('type')->defaultValue('text')->end()
            ->scalarNode('label')->defaultNull()->end()
            ->scalarNode('form_type')->defaultNull()->end()
            ->arrayNode('attributes')
                ->prototype('scalar')->defaultNull()->end()
            ->end()
            ->variableNode('default')->defaultNull()->end()
            ->variableNode('options')
                ->defaultValue([])
                ->validate()
                ->ifTrue(function ($value) {
                    return !\is_array($value) && null !== $value;
                })
                ->thenInvalid('"options" configuration must be an array or left empty')
                ->end()
            ->end()
            ->variableNode('form_options')
                ->defaultValue([])
                ->validate()
                ->ifTrue(function ($value) {
                    return !\is_array($value) && null !== $value;
                })
                ->thenInvalid('"form_options" configuration must be an array or left empty')
                ->end()
            ->end();
    }
69463
public function appendConfiguration(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->children()
                ->arrayNode('messages')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('languages')->performNoDeepMerging()->prototype('scalar')->end()->defaultValue(array('nl', 'en', 'fr'))->end()
                        ->booleanNode('overwrite_compatibility')->defaultTrue()->end()
                        ->scalarNode('yaz_cleanup')->end()
                    ->end()
                ->end()
            ->end()
        ;
    }
1231399
private function addOrmSection(ArrayNodeDefinition $node)
    {
        $node
            ->children()
                ->arrayNode('orm')
                    ->beforeNormalization()
                        ->ifTrue(static function ($v) {
                            if (! empty($v) && ! class_exists(EntityManager::class)) {
                                throw new LogicException('The doctrine/orm package is required when the doctrine.orm config is set.');
                            }

                            return $v === null || (is_array($v) && ! array_key_exists('entity_managers', $v) && ! array_key_exists('entity_manager', $v));
                        })
                        ->then(static function ($v) {
                            $v = (array) $v;
                            // Key that should not be rewritten to the connection config
                            $excludedKeys  = [
                                'default_entity_manager' => true,
                                'auto_generate_proxy_classes' => true,
                                'proxy_dir' => true,
                                'proxy_namespace' => true,
                                'resolve_target_entities' => true,
                                'resolve_target_entity' => true,
                            ];
                            $entityManager = [];
                            foreach ($v as $key => $value) {
                                if (isset($excludedKeys[$key])) {
                                    continue;
                                }
                                $entityManager[$key] = $v[$key];
                                unset($v[$key]);
                            }
                            $v['default_entity_manager'] = isset($v['default_entity_manager']) ? (string) $v['default_entity_manager'] : 'default';
                            $v['entity_managers']        = [$v['default_entity_manager'] => $entityManager];

                            return $v;
                        })
                    ->end()
                    ->children()
                        ->scalarNode('default_entity_manager')->end()
                        ->scalarNode('auto_generate_proxy_classes')->defaultValue(false)
                            ->info('Auto generate mode possible values are: "NEVER", "ALWAYS", "FILE_NOT_EXISTS", "EVAL"')
                            ->validate()
                                ->ifTrue(function ($v) {
                                    $generationModes = $this->getAutoGenerateModes();

                                    if (is_int($v) && in_array($v, $generationModes['values']/*array(0, 1, 2, 3)*/)) {
                                        return false;
                                    }
                                    if (is_bool($v)) {
                                        return false;
                                    }
                                    if (is_string($v)) {
                                        if (in_array(strtoupper($v), $generationModes['names']/*array('NEVER', 'ALWAYS', 'FILE_NOT_EXISTS', 'EVAL')*/)) {
                                            return false;
                                        }
                                    }

                                    return true;
                                })
                                ->thenInvalid('Invalid auto generate mode value %s')
                            ->end()
                            ->validate()
                                ->ifString()
                                ->then(static function ($v) {
                                    return constant('Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_' . strtoupper($v));
                                })
                            ->end()
                        ->end()
                        ->scalarNode('proxy_dir')->defaultValue('%kernel.cache_dir%/doctrine/orm/Proxies')->end()
                        ->scalarNode('proxy_namespace')->defaultValue('Proxies')->end()
                    ->end()
                    ->fixXmlConfig('entity_manager')
                    ->append($this->getOrmEntityManagersNode())
                    ->fixXmlConfig('resolve_target_entity', 'resolve_target_entities')
                    ->append($this->getOrmTargetEntityResolverNode())
                ->end()
            ->end();
    }
1356055
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder('twig');
        $rootNode = $treeBuilder->getRootNode();

        $rootNode
            ->children()
                ->scalarNode('exception_controller')->defaultValue('twig.controller.exception::showAction')->end()
            ->end()
        ;

        $this->addFormThemesSection($rootNode);
        $this->addGlobalsSection($rootNode);
        $this->addTwigOptions($rootNode);
        $this->addTwigFormatOptions($rootNode);

        return $treeBuilder;
    }