]> Raphaƫl G. Git Repositories - userbundle/blob - DependencyInjection/Configuration.php
Remove useless manifest
[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();
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 ->root('parameters')
87 ->addDefaultsIfNotSet()
88 ->children()
89 ->arrayNode('rapsys_user')
90 ->addDefaultsIfNotSet()
91 ->children()
92 ->arrayNode('class')
93 ->isRequired()
94 ->addDefaultsIfNotSet()
95 ->children()
96 ->scalarNode('group')->isRequired()->defaultValue($defaults['class']['group'])->end()
97 ->scalarNode('title')->isRequired()->defaultValue($defaults['class']['title'])->end()
98 ->scalarNode('user')->isRequired()->defaultValue($defaults['class']['user'])->end()
99 ->end()
100 ->end()
101 ->arrayNode('contact')
102 ->isRequired()
103 ->addDefaultsIfNotSet()
104 ->children()
105 ->scalarNode('name')->isRequired()->defaultValue($defaults['contact']['name'])->end()
106 ->scalarNode('mail')->isRequired()->defaultValue($defaults['contact']['mail'])->end()
107 ->scalarNode('home_name')->isRequired()->defaultValue($defaults['contact']['home_name'])->end()
108 ->arrayNode('home_args')
109 ->isRequired()
110 ->treatNullLike($defaults['contact']['home_args'])
111 ->defaultValue($defaults['contact']['home_args'])
112 ->scalarPrototype()->end()
113 ->end()
114 ->end()
115 ->end()
116 ->arrayNode('login')
117 ->isRequired()
118 ->addDefaultsIfNotSet()
119 ->children()
120 ->scalarNode('template')->isRequired()->defaultValue($defaults['login']['template'])->end()
121 ->arrayNode('context')
122 ->isRequired()
123 ->treatNullLike(array())
124 ->defaultValue($defaults['login']['context'])
125 ->scalarPrototype()->end()
126 ->end()
127 ->end()
128 ->end()
129 ->arrayNode('register')
130 ->isRequired()
131 ->addDefaultsIfNotSet()
132 ->children()
133 ->scalarNode('mail_template')->isRequired()->defaultValue($defaults['register']['mail_template'])->end()
134 ->arrayNode('mail_context')
135 ->isRequired()
136 ->treatNullLike($defaults['register']['mail_context'])
137 ->defaultValue($defaults['register']['mail_context'])
138 ->scalarPrototype()->end()
139 ->end()
140 ->scalarNode('template')->isRequired()->defaultValue($defaults['register']['template'])->end()
141 ->arrayNode('context')
142 ->isRequired()
143 ->treatNullLike($defaults['register']['context'])
144 ->defaultValue($defaults['register']['context'])
145 ->scalarPrototype()->end()
146 ->end()
147 ->end()
148 ->end()
149 ->arrayNode('recover')
150 ->isRequired()
151 ->addDefaultsIfNotSet()
152 ->children()
153 ->scalarNode('mail_template')->isRequired()->defaultValue($defaults['recover']['mail_template'])->end()
154 ->arrayNode('mail_context')
155 ->isRequired()
156 ->treatNullLike($defaults['recover']['mail_context'])
157 ->defaultValue($defaults['recover']['mail_context'])
158 ->scalarPrototype()->end()
159 ->end()
160 ->scalarNode('url_name')->isRequired()->defaultValue($defaults['recover']['url_name'])->end()
161 ->arrayNode('url_args')
162 ->isRequired()
163 ->treatNullLike($defaults['recover']['url_args'])
164 ->defaultValue($defaults['recover']['url_args'])
165 ->scalarPrototype()->end()
166 ->end()
167 ->scalarNode('template')->isRequired()->defaultValue($defaults['recover']['template'])->end()
168 ->arrayNode('context')
169 ->isRequired()
170 ->treatNullLike(array())
171 ->defaultValue($defaults['recover']['context'])
172 ->scalarPrototype()->end()
173 ->end()
174 ->end()
175 ->end()
176 ->arrayNode('recover_mail')
177 ->isRequired()
178 ->addDefaultsIfNotSet()
179 ->children()
180 ->scalarNode('mail_template')->isRequired()->defaultValue($defaults['recover']['mail_template'])->end()
181 ->arrayNode('mail_context')
182 ->isRequired()
183 ->treatNullLike($defaults['recover']['mail_context'])
184 ->defaultValue($defaults['recover']['mail_context'])
185 ->scalarPrototype()->end()
186 ->end()
187 ->scalarNode('url_name')->isRequired()->defaultValue($defaults['recover']['url_name'])->end()
188 ->arrayNode('url_args')
189 ->isRequired()
190 ->treatNullLike($defaults['recover']['url_args'])
191 ->defaultValue($defaults['recover']['url_args'])
192 ->scalarPrototype()->end()
193 ->end()
194 ->scalarNode('template')->isRequired()->defaultValue($defaults['recover']['template'])->end()
195 ->arrayNode('context')
196 ->isRequired()
197 ->treatNullLike(array())
198 ->defaultValue($defaults['recover']['context'])
199 ->scalarPrototype()->end()
200 ->end()
201 ->end()
202 ->end()
203 ->end()
204 ->end()
205 ->end()
206 ->end();
207
208 return $treeBuilder;
209 }
210 }