<?php declare(strict_types=1);
/*
- * This file is part of the Rapsys PackBundle package.
+ * This file is part of the Rapsys UserBundle package.
*
* (c) Raphaël Gertz <symfony@rapsys.eu>
*
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
+use Rapsys\UserBundle\RapsysUserBundle;
+
/**
* This is the class that validates and merges configuration from your app/config files.
*
- * @link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
+ * @link http://symfony.com/doc/current/cookbook/bundles/configuration.html
*
* {@inheritdoc}
*/
*/
public function getConfigTreeBuilder(): TreeBuilder {
//Set tree builder
- $treeBuilder = new TreeBuilder('rapsys_user');
+ $treeBuilder = new TreeBuilder(RapsysUserBundle::getAlias());
//The bundle default values
$defaults = [
]
],
'translate' => [],
- 'locales' => '%kernel.translator.fallbacks%',
'languages' => [
'en_gb' => 'English'
],
],
'context' => [],
'edit' => [
+ 'field' => [],
'route' => ['index' => 'index_url'],
'view' => [
- 'form' => 'Rapsys\UserBundle\Form\RegisterType',
'name' => '@RapsysUser/form/register.html.twig',
+ 'edit' => 'Rapsys\UserBundle\Form\RegisterType',
+ 'reset' => 'Rapsys\UserBundle\Form\LoginType',
'context' => []
]
],
'route' => ['index' => 'index_url', 'recover' => 'recover_url'],
'view' => [
'name' => '@RapsysUser/form/recover.html.twig',
- 'form' => 'Rapsys\UserBundle\Form\RecoverType',
+ 'form' => 'Rapsys\UserBundle\Form\LoginType',
'context' => []
],
'mail' => [
]
],
'register' => [
+ 'field' => [],
'route' => ['index' => 'index_url', 'confirm' => 'confirm_url'],
'view' => [
- 'form' => 'Rapsys\UserBundle\Form\RegisterType',
'name' => '@RapsysUser/form/register.html.twig',
+ 'form' => 'Rapsys\UserBundle\Form\RegisterType',
'context' => []
],
'mail' => [
->addDefaultsIfNotSet()
->children()
->arrayNode('class')
- ->addDefaultsIfNotSet()
- ->children()
- ->scalarNode('group')->cannotBeEmpty()->defaultValue($defaults['class']['group'])->end()
- ->scalarNode('civility')->cannotBeEmpty()->defaultValue($defaults['class']['civility'])->end()
- ->scalarNode('user')->cannotBeEmpty()->defaultValue($defaults['class']['user'])->end()
- ->end()
+ ->treatNullLike([])
+ ->defaultValue($defaults['class'])
+ ->scalarPrototype()->end()
->end()
->arrayNode('default')
- ->addDefaultsIfNotSet()
- ->children()
- ->scalarNode('civility')->cannotBeEmpty()->defaultValue($defaults['default']['civility'])->end()
- ->arrayNode('group')
- ->treatNullLike([])
- ->defaultValue($defaults['default']['group'])
- ->scalarPrototype()->end()
- ->end()
- ->end()
+ ->treatNullLike([])
+ ->defaultValue($defaults['default'])
+ ->variablePrototype()->end()
->end()
->arrayNode('route')
->addDefaultsIfNotSet()
->defaultValue($defaults['translate'])
->scalarPrototype()->end()
->end()
- ->scalarNode('locales')->cannotBeEmpty()->defaultValue($defaults['locales'])->end()
+ #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false)
->arrayNode('languages')
->treatNullLike([])
->defaultValue($defaults['languages'])
->arrayNode('edit')
->addDefaultsIfNotSet()
->children()
+ ->arrayNode('field')
+ ->treatNullLike([])
+ ->defaultValue($defaults['edit']['field'])
+ ->variablePrototype()->end()
+ ->end()
->arrayNode('route')
->treatNullLike([])
->defaultValue($defaults['edit']['route'])
->arrayNode('view')
->addDefaultsIfNotSet()
->children()
- ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['edit']['view']['form'])->end()
+ ->scalarNode('edit')->cannotBeEmpty()->defaultValue($defaults['edit']['view']['edit'])->end()
+ ->scalarNode('reset')->cannotBeEmpty()->defaultValue($defaults['edit']['view']['reset'])->end()
->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['edit']['view']['name'])->end()
->arrayNode('context')
->treatNullLike([])
->arrayNode('register')
->addDefaultsIfNotSet()
->children()
+ ->arrayNode('field')
+ ->treatNullLike([])
+ ->defaultValue($defaults['register']['field'])
+ ->variablePrototype()->end()
+ ->end()
->arrayNode('route')
->treatNullLike([])
->defaultValue($defaults['register']['route'])