]> Raphaël G. Git Repositories - airbundle/blob - DependencyInjection/Configuration.php
Add calendar default config
[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 'ico' => '@RapsysAir/ico/icon.ico',
27 'logo' => '@RapsysAir/png/logo.png',
28 //The png icon array
29 //XXX: see https://www.emergeinteractive.com/insights/detail/the-essentials-of-favicons/
30 //XXX: see https://caniuse.com/#feat=link-icon-svg
31 'png' => [
32 //Default
33 256 => '@RapsysAir/png/icon.256.png',
34
35 //For google
36 //Chrome for Android home screen icon
37 196 => '@RapsysAir/png/icon.196.png',
38 //Google Developer Web App Manifest Recommendation
39 192 => '@RapsysAir/png/icon.192.png',
40 //Chrome Web Store icon
41 128 => '@RapsysAir/png/icon.128.png',
42
43 //Fallback
44 32 => '@RapsysAir/png/icon.32.png',
45
46 //For apple
47 //XXX: old obsolete format: [57, 72, 76, 114, 120, 144]
48 //XXX: see https://webhint.io/docs/user-guide/hints/hint-apple-touch-icons/
49 //XXX: see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
50 //iPhone Retina
51 180 => '@RapsysAir/png/icon.180.png',
52 //iPad Retina touch icon
53 167 => '@RapsysAir/png/icon.167.png',
54 //iPad touch icon
55 152 => '@RapsysAir/png/icon.152.png',
56 //iOS7
57 120 => '@RapsysAir/png/icon.120.png',
58
59 //For windows
60 //XXX: see https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/dn255024(v=vs.85)
61 310 => '@RapsysAir/png/icon.310.png',
62 150 => '@RapsysAir/png/icon.150.png',
63 70 => '@RapsysAir/png/icon.70.png'
64 ],
65 'svg' => '@RapsysAir/svg/icon.svg',
66 'title' => 'Libre Air',
67 'url' => 'rapsys_air'
68 ],
69 'cache' => [
70 'namespace' => 'airlibre',
71 'lifetime' => 0,
72 'directory' => '%kernel.project_dir%/var/cache'
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' => 'Created by Raphaël',
83 'link' => 'https://rapsys.eu',
84 'long' => 'All rights reserved',
85 'short' => 'Copyright 2019-2021',
86 'title' => 'Rapsys'
87 ],
88 'contact' => [
89 'name' => 'John Doe',
90 'mail' => 'contact@example.com'
91 ],
92 'locale' => '%kernel.default_locale%',
93 'locales' => '%kernel.translator.fallbacks%',
94 'languages' => '%rapsys_user.languages%',
95 ];
96
97 //Here we define the parameters that are allowed to configure the bundle.
98 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
99 //TODO: see http://symfony.com/doc/current/components/config/definition.html
100 //XXX: use bin/console config:dump-reference to dump class infos
101
102 //Here we define the parameters that are allowed to configure the bundle.
103 $treeBuilder
104 //Parameters
105 ->getRootNode()
106 ->addDefaultsIfNotSet()
107 ->children()
108 ->arrayNode('site')
109 ->addDefaultsIfNotSet()
110 ->children()
111 ->scalarNode('ico')->cannotBeEmpty()->defaultValue($defaults['site']['ico'])->end()
112 ->scalarNode('logo')->cannotBeEmpty()->defaultValue($defaults['site']['logo'])->end()
113 ->arrayNode('png')
114 ->treatNullLike([])
115 ->defaultValue($defaults['site']['png'])
116 ->scalarPrototype()->end()
117 ->end()
118 ->scalarNode('svg')->cannotBeEmpty()->defaultValue($defaults['site']['svg'])->end()
119 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['site']['title'])->end()
120 ->scalarNode('url')->cannotBeEmpty()->defaultValue($defaults['site']['url'])->end()
121 ->end()
122 ->end()
123 ->arrayNode('cache')
124 ->addDefaultsIfNotSet()
125 ->children()
126 ->scalarNode('namespace')->defaultValue($defaults['cache']['namespace'])->end()
127 ->integerNode('lifetime')->min(0)->defaultValue($defaults['cache']['lifetime'])->end()
128 ->scalarNode('directory')->defaultValue($defaults['cache']['directory'])->end()
129 ->end()
130 ->end()
131 ->arrayNode('calendar')
132 ->addDefaultsIfNotSet()
133 ->children()
134 ->scalarNode('calendar')->defaultValue($defaults['calendar']['calendar'])->end()
135 ->scalarNode('prefix')->defaultValue($defaults['calendar']['prefix'])->end()
136 ->scalarNode('project')->defaultValue($defaults['calendar']['project'])->end()
137 ->scalarNode('client')->defaultValue($defaults['calendar']['client'])->end()
138 ->scalarNode('secret')->defaultValue($defaults['calendar']['secret'])->end()
139 ->end()
140 ->end()
141 ->arrayNode('copy')
142 ->addDefaultsIfNotSet()
143 ->children()
144 ->scalarNode('by')->defaultValue($defaults['copy']['by'])->end()
145 ->scalarNode('link')->defaultValue($defaults['copy']['link'])->end()
146 ->scalarNode('long')->defaultValue($defaults['copy']['long'])->end()
147 ->scalarNode('short')->defaultValue($defaults['copy']['short'])->end()
148 ->scalarNode('title')->defaultValue($defaults['copy']['title'])->end()
149 ->end()
150 ->end()
151 ->arrayNode('contact')
152 ->addDefaultsIfNotSet()
153 ->children()
154 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['contact']['name'])->end()
155 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
156 ->end()
157 ->end()
158 ->scalarNode('locale')->cannotBeEmpty()->defaultValue($defaults['locale'])->end()
159 ->scalarNode('locales')->cannotBeEmpty()->defaultValue($defaults['locales'])->end()
160 ->scalarNode('languages')->cannotBeEmpty()->defaultValue($defaults['languages'])->end()
161 ->end()
162 ->end();
163
164 return $treeBuilder;
165 }
166 }