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('rapsys_user');
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()
90 ->addDefaultsIfNotSet()
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()
97 ->arrayNode('contact')
98 ->addDefaultsIfNotSet()
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')
105 ->treatNullLike($defaults['contact']['home_args'])
106 ->defaultValue($defaults['contact']['home_args'])
107 ->scalarPrototype()->end()
112 ->addDefaultsIfNotSet()
114 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['login']['template'])->end()
115 ->arrayNode('context')
117 ->treatNullLike(array())
118 ->defaultValue($defaults['login']['context'])
119 ->scalarPrototype()->end()
123 ->arrayNode('register')
124 ->addDefaultsIfNotSet()
126 ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['register']['mail_template'])->end()
127 ->arrayNode('mail_context')
129 ->treatNullLike($defaults['register']['mail_context'])
130 ->defaultValue($defaults['register']['mail_context'])
131 ->scalarPrototype()->end()
133 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['register']['template'])->end()
134 ->arrayNode('context')
136 ->treatNullLike($defaults['register']['context'])
137 ->defaultValue($defaults['register']['context'])
138 ->scalarPrototype()->end()
142 ->arrayNode('recover')
143 ->addDefaultsIfNotSet()
145 ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['recover']['mail_template'])->end()
146 ->arrayNode('mail_context')
148 ->treatNullLike($defaults['recover']['mail_context'])
149 ->defaultValue($defaults['recover']['mail_context'])
150 ->scalarPrototype()->end()
152 ->scalarNode('url_name')->cannotBeEmpty()->defaultValue($defaults['recover']['url_name'])->end()
153 ->arrayNode('url_args')
155 ->treatNullLike($defaults['recover']['url_args'])
156 ->defaultValue($defaults['recover']['url_args'])
157 ->scalarPrototype()->end()
159 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['recover']['template'])->end()
160 ->arrayNode('context')
162 ->treatNullLike(array())
163 ->defaultValue($defaults['recover']['context'])
164 ->scalarPrototype()->end()
168 ->arrayNode('recover_mail')
169 ->addDefaultsIfNotSet()
171 ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['recover']['mail_template'])->end()
172 ->arrayNode('mail_context')
174 ->treatNullLike($defaults['recover']['mail_context'])
175 ->defaultValue($defaults['recover']['mail_context'])
176 ->scalarPrototype()->end()
178 ->scalarNode('url_name')->cannotBeEmpty()->defaultValue($defaults['recover']['url_name'])->end()
179 ->arrayNode('url_args')
181 ->treatNullLike($defaults['recover']['url_args'])
182 ->defaultValue($defaults['recover']['url_args'])
183 ->scalarPrototype()->end()
185 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['recover']['template'])->end()
186 ->arrayNode('context')
188 ->treatNullLike(array())
189 ->defaultValue($defaults['recover']['context'])
190 ->scalarPrototype()->end()