]> Raphaƫl G. Git Repositories - userbundle/blob - DependencyInjection/Configuration.php
Change alphabet generation
[userbundle] / DependencyInjection / Configuration.php
1 <?php
2
3 namespace Rapsys\UserBundle\DependencyInjection;
4
5 use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6 use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8 /**
9 * This is the class that validates and merges configuration from your app/config files.
10 *
11 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
12 */
13 class Configuration implements ConfigurationInterface {
14 /**
15 * {@inheritdoc}
16 */
17 public function getConfigTreeBuilder() {
18 //Set tree builder
19 $treeBuilder = new TreeBuilder('rapsys_user');
20
21 //The bundle default values
22 $defaults = [
23 'class' => [
24 'group' => 'Rapsys\\UserBundle\\Entity\\Group',
25 'title' => 'Rapsys\\UserBundle\\Entity\\Title',
26 'user' => 'Rapsys\\UserBundle\\Entity\\User'
27 ],
28 'contact' => [
29 'name' => 'John Doe',
30 'mail' => 'contact@example.com',
31 'home_name' => 'rapsys_user_homepage',
32 'home_args' => []
33 ],
34 'login' => [
35 'template' => '@@RapsysUser/security/login.html.twig',
36 'context' => []
37 ],
38 'register' => [
39 'mail_template' => '@@RapsysUser/mail/register.html.twig',
40 'mail_context' => [
41 'title' => 'Title',
42 'subtitle' => 'Hi, %%name%%',
43 'subject' => 'Welcome to %%title%%',
44 'message' => 'Thanks so much for joining us, from now on, you are part of %%title%%.'
45 ],
46 'template' => '@@RapsysUser/security/register.html.twig',
47 'context' => []
48 ],
49 'recover' => [
50 'mail_template' => '@@RapsysUser/mail/recover.html.twig',
51 'mail_context' => [
52 'title' => 'Title',
53 'subtitle' => 'Hi, %%name%%',
54 'subject' => 'Recover account on %%title%%',
55 'raw' => 'Thanks so much for joining us, to recover your account you can follow this link: <a href="%%url%%">%%url%%</a>'
56 ],
57 'url_name' => 'rapsys_user_recover_mail',
58 'url_args' => [],
59 'template' => '@@RapsysUser/security/recover.html.twig',
60 'context' => []
61 ],
62 'recover_mail' => [
63 'mail_template' => '@@RapsysUser/mail/recover.html.twig',
64 'mail_context' => [
65 'title' => 'Title',
66 'subtitle' => 'Hi, %%name%%',
67 'subject' => 'Account recovered on %%title%%',
68 'raw' => 'Your account password has been changed, to recover your account you can follow this link: <a href="%%url%%">%%url%%</a>'
69 ],
70 'url_name' => 'rapsys_user_recover_mail',
71 'url_args' => [],
72 'template' => '@@RapsysUser/security/recover_mail.html.twig',
73 'context' => []
74 ]
75 ];
76
77 //Here we define the parameters that are allowed to configure the bundle.
78 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
79 //TODO: see http://symfony.com/doc/current/components/config/definition.html
80 //TODO: see fosuser DependencyInjection/Configuration.php
81 //XXX: use bin/console config:dump-reference to dump class infos
82
83 //Here we define the parameters that are allowed to configure the bundle.
84 $treeBuilder
85 //Parameters
86 ->getRootNode()
87 ->addDefaultsIfNotSet()
88 ->children()
89 ->arrayNode('class')
90 ->addDefaultsIfNotSet()
91 ->children()
92 ->scalarNode('group')->cannotBeEmpty()->defaultValue($defaults['class']['group'])->end()
93 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['class']['title'])->end()
94 ->scalarNode('user')->cannotBeEmpty()->defaultValue($defaults['class']['user'])->end()
95 ->end()
96 ->end()
97 ->arrayNode('contact')
98 ->addDefaultsIfNotSet()
99 ->children()
100 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['contact']['name'])->end()
101 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
102 ->scalarNode('home_name')->cannotBeEmpty()->defaultValue($defaults['contact']['home_name'])->end()
103 ->arrayNode('home_args')
104 ->treatNullLike($defaults['contact']['home_args'])
105 ->defaultValue($defaults['contact']['home_args'])
106 ->scalarPrototype()->end()
107 ->end()
108 ->end()
109 ->end()
110 ->arrayNode('login')
111 ->addDefaultsIfNotSet()
112 ->children()
113 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['login']['template'])->end()
114 ->arrayNode('context')
115 ->treatNullLike(array())
116 ->defaultValue($defaults['login']['context'])
117 ->scalarPrototype()->end()
118 ->end()
119 ->end()
120 ->end()
121 ->arrayNode('register')
122 ->addDefaultsIfNotSet()
123 ->children()
124 ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['register']['mail_template'])->end()
125 ->arrayNode('mail_context')
126 ->cannotBeEmpty()
127 ->treatNullLike($defaults['register']['mail_context'])
128 ->defaultValue($defaults['register']['mail_context'])
129 ->scalarPrototype()->end()
130 ->end()
131 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['register']['template'])->end()
132 ->arrayNode('context')
133 ->treatNullLike($defaults['register']['context'])
134 ->defaultValue($defaults['register']['context'])
135 ->scalarPrototype()->end()
136 ->end()
137 ->end()
138 ->end()
139 ->arrayNode('recover')
140 ->addDefaultsIfNotSet()
141 ->children()
142 ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['recover']['mail_template'])->end()
143 ->arrayNode('mail_context')
144 ->cannotBeEmpty()
145 ->treatNullLike($defaults['recover']['mail_context'])
146 ->defaultValue($defaults['recover']['mail_context'])
147 ->scalarPrototype()->end()
148 ->end()
149 ->scalarNode('url_name')->cannotBeEmpty()->defaultValue($defaults['recover']['url_name'])->end()
150 ->arrayNode('url_args')
151 ->treatNullLike($defaults['recover']['url_args'])
152 ->defaultValue($defaults['recover']['url_args'])
153 ->scalarPrototype()->end()
154 ->end()
155 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['recover']['template'])->end()
156 ->arrayNode('context')
157 ->treatNullLike(array())
158 ->defaultValue($defaults['recover']['context'])
159 ->scalarPrototype()->end()
160 ->end()
161 ->end()
162 ->end()
163 ->arrayNode('recover_mail')
164 ->addDefaultsIfNotSet()
165 ->children()
166 ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['recover']['mail_template'])->end()
167 ->arrayNode('mail_context')
168 ->cannotBeEmpty()
169 ->treatNullLike($defaults['recover']['mail_context'])
170 ->defaultValue($defaults['recover']['mail_context'])
171 ->scalarPrototype()->end()
172 ->end()
173 ->scalarNode('url_name')->cannotBeEmpty()->defaultValue($defaults['recover']['url_name'])->end()
174 ->arrayNode('url_args')
175 ->treatNullLike($defaults['recover']['url_args'])
176 ->defaultValue($defaults['recover']['url_args'])
177 ->scalarPrototype()->end()
178 ->end()
179 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['recover']['template'])->end()
180 ->arrayNode('context')
181 ->treatNullLike(array())
182 ->defaultValue($defaults['recover']['context'])
183 ->scalarPrototype()->end()
184 ->end()
185 ->end()
186 ->end()
187 ->end()
188 ->end();
189
190 return $treeBuilder;
191 }
192 }