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')
104 ->treatNullLike($defaults['contact']['home_args'])
105 ->defaultValue($defaults['contact']['home_args'])
106 ->scalarPrototype()->end()
111 ->addDefaultsIfNotSet()
113 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['login']['template'])->end()
114 ->arrayNode('context')
115 ->treatNullLike(array())
116 ->defaultValue($defaults['login']['context'])
117 ->scalarPrototype()->end()
121 ->arrayNode('register')
122 ->addDefaultsIfNotSet()
124 ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['register']['mail_template'])->end()
125 ->arrayNode('mail_context')
127 ->treatNullLike($defaults['register']['mail_context'])
128 ->defaultValue($defaults['register']['mail_context'])
129 ->scalarPrototype()->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()
139 ->arrayNode('recover')
140 ->addDefaultsIfNotSet()
142 ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['recover']['mail_template'])->end()
143 ->arrayNode('mail_context')
145 ->treatNullLike($defaults['recover']['mail_context'])
146 ->defaultValue($defaults['recover']['mail_context'])
147 ->scalarPrototype()->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()
155 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['recover']['template'])->end()
156 ->arrayNode('context')
157 ->treatNullLike(array())
158 ->defaultValue($defaults['recover']['context'])
159 ->scalarPrototype()->end()
163 ->arrayNode('recover_mail')
164 ->addDefaultsIfNotSet()
166 ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['recover']['mail_template'])->end()
167 ->arrayNode('mail_context')
169 ->treatNullLike($defaults['recover']['mail_context'])
170 ->defaultValue($defaults['recover']['mail_context'])
171 ->scalarPrototype()->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()
179 ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['recover']['template'])->end()
180 ->arrayNode('context')
181 ->treatNullLike(array())
182 ->defaultValue($defaults['recover']['context'])
183 ->scalarPrototype()->end()