3 namespace Rapsys\UserBundle\DependencyInjection
;
5 use Symfony\Component\Config\Definition\Builder\TreeBuilder
;
6 use Symfony\Component\Config\Definition\ConfigurationInterface
;
9 * This is the class that validates and merges configuration from your app/config files.
11 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
13 class Configuration
implements ConfigurationInterface
{
17 public function getConfigTreeBuilder() {
19 $treeBuilder = new TreeBuilder('parameters');
21 //The bundle default values
24 'group' => 'Rapsys\\UserBundle\\Entity\\Group',
25 'title' => 'Rapsys\\UserBundle\\Entity\\Title',
26 'user' => 'Rapsys\\UserBundle\\Entity\\User'
30 'mail' => 'contact@example.com',
31 'home_name' => 'rapsys_user_homepage',
35 'template' => '@@RapsysUser/security/login.html.twig',
39 'mail_template' => '@@RapsysUser/mail/register.html.twig',
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%%.'
46 'template' => '@@RapsysUser/security/register.html.twig',
50 'mail_template' => '@@RapsysUser/mail/recover.html.twig',
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>'
57 'url_name' => 'rapsys_user_recover_mail',
59 'template' => '@@RapsysUser/security/recover.html.twig',
63 'mail_template' => '@@RapsysUser/mail/recover.html.twig',
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>'
70 'url_name' => 'rapsys_user_recover_mail',
72 'template' => '@@RapsysUser/security/recover_mail.html.twig',
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
83 //Here we define the parameters that are allowed to configure the bundle.
87 ->addDefaultsIfNotSet()
89 ->arrayNode('rapsys_user')
90 ->addDefaultsIfNotSet()
94 ->addDefaultsIfNotSet()
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()
101 ->arrayNode('contact')
103 ->addDefaultsIfNotSet()
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')
110 ->treatNullLike($defaults['contact']['home_args'])
111 ->defaultValue($defaults['contact']['home_args'])
112 ->scalarPrototype()->end()
118 ->addDefaultsIfNotSet()
120 ->scalarNode('template')->isRequired()->defaultValue($defaults['login']['template'])->end()
121 ->arrayNode('context')
123 ->treatNullLike(array())
124 ->defaultValue($defaults['login']['context'])
125 ->scalarPrototype()->end()
129 ->arrayNode('register')
131 ->addDefaultsIfNotSet()
133 ->scalarNode('mail_template')->isRequired()->defaultValue($defaults['register']['mail_template'])->end()
134 ->arrayNode('mail_context')
136 ->treatNullLike($defaults['register']['mail_context'])
137 ->defaultValue($defaults['register']['mail_context'])
138 ->scalarPrototype()->end()
140 ->scalarNode('template')->isRequired()->defaultValue($defaults['register']['template'])->end()
141 ->arrayNode('context')
143 ->treatNullLike($defaults['register']['context'])
144 ->defaultValue($defaults['register']['context'])
145 ->scalarPrototype()->end()
149 ->arrayNode('recover')
151 ->addDefaultsIfNotSet()
153 ->scalarNode('mail_template')->isRequired()->defaultValue($defaults['recover']['mail_template'])->end()
154 ->arrayNode('mail_context')
156 ->treatNullLike($defaults['recover']['mail_context'])
157 ->defaultValue($defaults['recover']['mail_context'])
158 ->scalarPrototype()->end()
160 ->scalarNode('url_name')->isRequired()->defaultValue($defaults['recover']['url_name'])->end()
161 ->arrayNode('url_args')
163 ->treatNullLike($defaults['recover']['url_args'])
164 ->defaultValue($defaults['recover']['url_args'])
165 ->scalarPrototype()->end()
167 ->scalarNode('template')->isRequired()->defaultValue($defaults['recover']['template'])->end()
168 ->arrayNode('context')
170 ->treatNullLike(array())
171 ->defaultValue($defaults['recover']['context'])
172 ->scalarPrototype()->end()
176 ->arrayNode('recover_mail')
178 ->addDefaultsIfNotSet()
180 ->scalarNode('mail_template')->isRequired()->defaultValue($defaults['recover']['mail_template'])->end()
181 ->arrayNode('mail_context')
183 ->treatNullLike($defaults['recover']['mail_context'])
184 ->defaultValue($defaults['recover']['mail_context'])
185 ->scalarPrototype()->end()
187 ->scalarNode('url_name')->isRequired()->defaultValue($defaults['recover']['url_name'])->end()
188 ->arrayNode('url_args')
190 ->treatNullLike($defaults['recover']['url_args'])
191 ->defaultValue($defaults['recover']['url_args'])
192 ->scalarPrototype()->end()
194 ->scalarNode('template')->isRequired()->defaultValue($defaults['recover']['template'])->end()
195 ->arrayNode('context')
197 ->treatNullLike(array())
198 ->defaultValue($defaults['recover']['context'])
199 ->scalarPrototype()->end()