]> Raphaƫl G. Git Repositories - airbundle/blob - DependencyInjection/Configuration.php
Remove recover_mail stuff
[airbundle] / DependencyInjection / Configuration.php
1 <?php
2
3 namespace Rapsys\AirBundle\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 $treeBuilder = new TreeBuilder('rapsys_air');
19
20 // Here you should define the parameters that are allowed to
21 // configure your bundle. See the documentation linked above for
22 // more information on that topic.
23 //Set defaults
24 $defaults = [
25 'site' => [
26 'donate' => 'https://paypal.me/milongaraphael',
27 'ico' => '@RapsysAir/ico/icon.ico',
28 'logo' => '@RapsysAir/png/logo.png',
29 //The png icon array
30 //XXX: see https://www.emergeinteractive.com/insights/detail/the-essentials-of-favicons/
31 //XXX: see https://caniuse.com/#feat=link-icon-svg
32 'png' => [
33 //Default
34 256 => '@RapsysAir/png/icon.256.png',
35
36 //For google
37 //Chrome for Android home screen icon
38 196 => '@RapsysAir/png/icon.196.png',
39 //Google Developer Web App Manifest Recommendation
40 192 => '@RapsysAir/png/icon.192.png',
41 //Chrome Web Store icon
42 128 => '@RapsysAir/png/icon.128.png',
43
44 //Fallback
45 32 => '@RapsysAir/png/icon.32.png',
46
47 //For apple
48 //XXX: old obsolete format: [57, 72, 76, 114, 120, 144]
49 //XXX: see https://webhint.io/docs/user-guide/hints/hint-apple-touch-icons/
50 //XXX: see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
51 //iPhone Retina
52 180 => '@RapsysAir/png/icon.180.png',
53 //iPad Retina touch icon
54 167 => '@RapsysAir/png/icon.167.png',
55 //iPad touch icon
56 152 => '@RapsysAir/png/icon.152.png',
57 //iOS7
58 120 => '@RapsysAir/png/icon.120.png',
59
60 //For windows
61 //XXX: see https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/dn255024(v=vs.85)
62 310 => '@RapsysAir/png/icon.310.png',
63 150 => '@RapsysAir/png/icon.150.png',
64 70 => '@RapsysAir/png/icon.70.png'
65 ],
66 'svg' => '@RapsysAir/svg/icon.svg',
67 'title' => 'Libre Air',
68 'url' => 'rapsys_air'
69 ],
70 'cache' => [
71 'namespace' => 'airlibre',
72 'lifetime' => 0
73 ],
74 'calendar' => [
75 'calendar' => 'rmg68hd51sploubp5qffdthiak@group.calendar.google.com',
76 'prefix' => 'airlibre',
77 'project' => 'calendar-317315',
78 'client' => '635317121880-usqucmne71jnmprl8br9khh2om4n8cmh.apps.googleusercontent.com',
79 'secret' => 'HRsKd4FIc9gxQHM4IoBWnlbD'
80 ],
81 'copy' => [
82 'by' => 'Rapsys',
83 'link' => 'https://rapsys.eu',
84 'long' => 'All rights reserved',
85 'short' => 'Copyright 2019-2021',
86 'title' => 'Rapsys'
87 ],
88 'contact' => [
89 'title' => 'Libre Air',
90 'mail' => 'contact@airlibre.eu'
91 ],
92 'facebook' => [
93 'apps' => [3728770287223690],
94 'height' => 630,
95 'width' => 1200
96 ],
97 'locale' => '%kernel.default_locale%',
98 'locales' => '%kernel.translator.fallbacks%',
99 //XXX: revert to underscore because of that shit:
100 //XXX: see https://symfony.com/doc/current/components/config/definition.html#normalization
101 //XXX: see https://github.com/symfony/symfony/issues/7405
102 'languages' => '%rapsys_user.languages%',
103 'path' => [
104 'cache' => '%kernel.project_dir%/var/cache',
105 'public' => dirname(__DIR__).'/Resources/public'
106 ]
107 ];
108
109 //Here we define the parameters that are allowed to configure the bundle.
110 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
111 //TODO: see http://symfony.com/doc/current/components/config/definition.html
112 //XXX: use bin/console config:dump-reference to dump class infos
113
114 //Here we define the parameters that are allowed to configure the bundle.
115 $treeBuilder
116 //Parameters
117 ->getRootNode()
118 ->addDefaultsIfNotSet()
119 ->children()
120 ->arrayNode('site')
121 ->addDefaultsIfNotSet()
122 ->children()
123 ->scalarNode('donate')->cannotBeEmpty()->defaultValue($defaults['site']['donate'])->end()
124 ->scalarNode('ico')->cannotBeEmpty()->defaultValue($defaults['site']['ico'])->end()
125 ->scalarNode('logo')->cannotBeEmpty()->defaultValue($defaults['site']['logo'])->end()
126 ->arrayNode('png')
127 ->treatNullLike([])
128 ->defaultValue($defaults['site']['png'])
129 ->scalarPrototype()->end()
130 ->end()
131 ->scalarNode('svg')->cannotBeEmpty()->defaultValue($defaults['site']['svg'])->end()
132 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['site']['title'])->end()
133 ->scalarNode('url')->cannotBeEmpty()->defaultValue($defaults['site']['url'])->end()
134 ->end()
135 ->end()
136 ->arrayNode('cache')
137 ->addDefaultsIfNotSet()
138 ->children()
139 ->scalarNode('namespace')->defaultValue($defaults['cache']['namespace'])->end()
140 ->integerNode('lifetime')->min(0)->defaultValue($defaults['cache']['lifetime'])->end()
141 ->end()
142 ->end()
143 ->arrayNode('calendar')
144 ->addDefaultsIfNotSet()
145 ->children()
146 ->scalarNode('calendar')->defaultValue($defaults['calendar']['calendar'])->end()
147 ->scalarNode('prefix')->defaultValue($defaults['calendar']['prefix'])->end()
148 ->scalarNode('project')->defaultValue($defaults['calendar']['project'])->end()
149 ->scalarNode('client')->defaultValue($defaults['calendar']['client'])->end()
150 ->scalarNode('secret')->defaultValue($defaults['calendar']['secret'])->end()
151 ->end()
152 ->end()
153 ->arrayNode('copy')
154 ->addDefaultsIfNotSet()
155 ->children()
156 ->scalarNode('by')->defaultValue($defaults['copy']['by'])->end()
157 ->scalarNode('link')->defaultValue($defaults['copy']['link'])->end()
158 ->scalarNode('long')->defaultValue($defaults['copy']['long'])->end()
159 ->scalarNode('short')->defaultValue($defaults['copy']['short'])->end()
160 ->scalarNode('title')->defaultValue($defaults['copy']['title'])->end()
161 ->end()
162 ->end()
163 ->arrayNode('contact')
164 ->addDefaultsIfNotSet()
165 ->children()
166 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['contact']['title'])->end()
167 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
168 ->end()
169 ->end()
170 ->arrayNode('facebook')
171 ->addDefaultsIfNotSet()
172 ->children()
173 ->arrayNode('apps')
174 ->treatNullLike([])
175 ->defaultValue($defaults['facebook']['apps'])
176 ->scalarPrototype()->end()
177 ->end()
178 ->integerNode('height')->min(0)->defaultValue($defaults['facebook']['height'])->end()
179 ->integerNode('width')->min(0)->defaultValue($defaults['facebook']['width'])->end()
180 ->end()
181 ->end()
182 ->scalarNode('locale')->cannotBeEmpty()->defaultValue($defaults['locale'])->end()
183 ->scalarNode('locales')->cannotBeEmpty()->defaultValue($defaults['locales'])->end()
184 ->scalarNode('languages')->cannotBeEmpty()->defaultValue($defaults['languages'])->end()
185 ->arrayNode('path')
186 ->addDefaultsIfNotSet()
187 ->children()
188 ->scalarNode('cache')->defaultValue($defaults['path']['cache'])->end()
189 ->scalarNode('public')->defaultValue($defaults['path']['public'])->end()
190 ->end()
191 ->end()
192 ->end()
193 ->end();
194
195 return $treeBuilder;
196 }
197 }