]> Raphaël G. Git Repositories - userbundle/blobdiff - DependencyInjection/Configuration.php
Reorder fields
[userbundle] / DependencyInjection / Configuration.php
index b22d973cfb6d1fdd227c10b8d1f1fc0ff3f0d182..ade173ffef0f0dc305b4905314a8b39af5c23737 100644 (file)
@@ -1,7 +1,7 @@
 <?php declare(strict_types=1);
 
 /*
 <?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>
  *
  *
  * (c) Raphaël Gertz <symfony@rapsys.eu>
  *
@@ -14,10 +14,12 @@ namespace Rapsys\UserBundle\DependencyInjection;
 use Symfony\Component\Config\Definition\Builder\TreeBuilder;
 use Symfony\Component\Config\Definition\ConfigurationInterface;
 
 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.
  *
 /**
  * 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}
  */
  *
  * {@inheritdoc}
  */
@@ -27,7 +29,7 @@ class Configuration implements ConfigurationInterface {
         */
        public function getConfigTreeBuilder(): TreeBuilder {
                //Set tree builder
         */
        public function getConfigTreeBuilder(): TreeBuilder {
                //Set tree builder
-               $treeBuilder = new TreeBuilder('rapsys_user');
+               $treeBuilder = new TreeBuilder(RapsysUserBundle::getAlias());
 
                //The bundle default values
                $defaults = [
 
                //The bundle default values
                $defaults = [
@@ -77,10 +79,12 @@ class Configuration implements ConfigurationInterface {
                        ],
                        'context' => [],
                        'edit' => [
                        ],
                        'context' => [],
                        'edit' => [
+                               'field' => [],
                                'route' => ['index' => 'index_url'],
                                'view' => [
                                'route' => ['index' => 'index_url'],
                                'view' => [
-                                       'form' => 'Rapsys\UserBundle\Form\RegisterType',
                                        'name' => '@RapsysUser/form/register.html.twig',
                                        'name' => '@RapsysUser/form/register.html.twig',
+                                       'edit' => 'Rapsys\UserBundle\Form\RegisterType',
+                                       'reset' => 'Rapsys\UserBundle\Form\LoginType',
                                        'context' => []
                                ]
                        ],
                                        'context' => []
                                ]
                        ],
@@ -96,7 +100,7 @@ class Configuration implements ConfigurationInterface {
                                'route' => ['index' => 'index_url', 'recover' => 'recover_url'],
                                'view' => [
                                        'name' => '@RapsysUser/form/recover.html.twig',
                                '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' => [
                                        'context' => []
                                ],
                                'mail' => [
@@ -107,10 +111,11 @@ class Configuration implements ConfigurationInterface {
                                ]
                        ],
                        'register' => [
                                ]
                        ],
                        'register' => [
+                               'field' => [],
                                'route' => ['index' => 'index_url', 'confirm' => 'confirm_url'],
                                'view' => [
                                'route' => ['index' => 'index_url', 'confirm' => 'confirm_url'],
                                'view' => [
-                                       'form' => 'Rapsys\UserBundle\Form\RegisterType',
                                        'name' => '@RapsysUser/form/register.html.twig',
                                        'name' => '@RapsysUser/form/register.html.twig',
+                                       'form' => 'Rapsys\UserBundle\Form\RegisterType',
                                        'context' => []
                                ],
                                'mail' => [
                                        'context' => []
                                ],
                                'mail' => [
@@ -138,12 +143,9 @@ class Configuration implements ConfigurationInterface {
                                ->addDefaultsIfNotSet()
                                ->children()
                                        ->arrayNode('class')
                                ->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()
                                        ->end()
                                        ->arrayNode('default')
                                                ->addDefaultsIfNotSet()
@@ -253,6 +255,11 @@ class Configuration implements ConfigurationInterface {
                                        ->arrayNode('edit')
                                                ->addDefaultsIfNotSet()
                                                ->children()
                                        ->arrayNode('edit')
                                                ->addDefaultsIfNotSet()
                                                ->children()
+                                                       ->arrayNode('field')
+                                                               ->treatNullLike([])
+                                                               ->defaultValue($defaults['edit']['field'])
+                                                               ->variablePrototype()->end()
+                                                       ->end()
                                                        ->arrayNode('route')
                                                                ->treatNullLike([])
                                                                ->defaultValue($defaults['edit']['route'])
                                                        ->arrayNode('route')
                                                                ->treatNullLike([])
                                                                ->defaultValue($defaults['edit']['route'])
@@ -261,7 +268,8 @@ class Configuration implements ConfigurationInterface {
                                                        ->arrayNode('view')
                                                                ->addDefaultsIfNotSet()
                                                                ->children()
                                                        ->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([])
                                                                        ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['edit']['view']['name'])->end()
                                                                        ->arrayNode('context')
                                                                                ->treatNullLike([])
@@ -332,6 +340,11 @@ class Configuration implements ConfigurationInterface {
                                        ->arrayNode('register')
                                                ->addDefaultsIfNotSet()
                                                ->children()
                                        ->arrayNode('register')
                                                ->addDefaultsIfNotSet()
                                                ->children()
+                                                       ->arrayNode('field')
+                                                               ->treatNullLike([])
+                                                               ->defaultValue($defaults['register']['field'])
+                                                               ->variablePrototype()->end()
+                                                       ->end()
                                                        ->arrayNode('route')
                                                                ->treatNullLike([])
                                                                ->defaultValue($defaults['register']['route'])
                                                        ->arrayNode('route')
                                                                ->treatNullLike([])
                                                                ->defaultValue($defaults['register']['route'])