3 namespace Rapsys\AirBundle\DependencyInjection
;
5 use Symfony\Component\Config\Definition\Builder\TreeBuilder
;
6 use Symfony\Component\Config\Definition\ConfigurationInterface
;
8 use Rapsys\AirBundle\RapsysAirBundle
;
11 * This is the class that validates and merges configuration from your app/config files.
13 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
15 class Configuration
implements ConfigurationInterface
{
19 public function getConfigTreeBuilder() {
20 $treeBuilder = new TreeBuilder($alias = RapsysAirBundle
::getAlias());
22 // Here you should define the parameters that are allowed to
23 // configure your bundle. See the documentation linked above for
24 // more information on that topic.
28 'donate' => 'https://paypal.me/milongaraphael',
30 'ico' => '@RapsysAir/ico/icon.ico',
31 'svg' => '@RapsysAir/svg/icon.svg'
34 'png' => '@RapsysAir/png/logo.png',
35 'svg' => '@RapsysAir/svg/logo.svg'
38 //XXX: see https://www.emergeinteractive.com/insights/detail/the-essentials-of-favicons/
39 //XXX: see https://caniuse.com/#feat=link-icon-svg
42 256 => '@RapsysAir/png/icon.256.png',
45 //Chrome for Android home screen icon
46 196 => '@RapsysAir/png/icon.196.png',
47 //Google Developer Web App Manifest Recommendation
48 192 => '@RapsysAir/png/icon.192.png',
49 //Chrome Web Store icon
50 128 => '@RapsysAir/png/icon.128.png',
53 32 => '@RapsysAir/png/icon.32.png',
56 //XXX: old obsolete format: [57, 72, 76, 114, 120, 144]
57 //XXX: see https://webhint.io/docs/user-guide/hints/hint-apple-touch-icons/
58 //XXX: see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
60 180 => '@RapsysAir/png/icon.180.png',
61 //iPad Retina touch icon
62 167 => '@RapsysAir/png/icon.167.png',
64 152 => '@RapsysAir/png/icon.152.png',
66 120 => '@RapsysAir/png/icon.120.png',
69 //XXX: see https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/dn255024(v=vs.85)
70 310 => '@RapsysAir/png/icon.310.png',
71 150 => '@RapsysAir/png/icon.150.png',
72 70 => '@RapsysAir/png/icon.70.png'
74 'title' => 'Libre Air',
78 'calendar' => '%env(string:RAPSYSAIR_CALENDAR)',
79 'prefix' => '%env(string:RAPSYSAIR_PREFIX)',
80 'project' => '%env(string:RAPSYSAIR_PROJECT)',
81 'client' => '%env(string:GOOGLE_CLIENT_ID)',
82 'secret' => '%env(string:GOOGLE_CLIENT_SECRET)'
86 'link' => 'https://rapsys.eu',
87 'long' => 'All rights reserved',
88 'short' => 'Copyright 2019-2021',
92 'title' => 'Libre Air',
93 'mail' => 'contact@airlibre.eu'
96 'apps' => [3728770287223690],
100 'locale' => '%kernel.default_locale%',
101 'locales' => '%kernel.translator.fallbacks%',
102 //XXX: revert to underscore because of that shit:
103 //XXX: see https://symfony.com/doc/current/components/config/definition.html#normalization
104 //XXX: see https://github.com/symfony/symfony/issues/7405
105 'languages' => '%rapsys_user.languages%',
106 'path' => is_link(($prefix = is_dir('public') ? './public/' : './').($link = 'bundles/'.str_replace('_', '', $alias))) && is_dir(realpath($prefix.$link)) || is_dir($prefix.$link) ? $link : dirname(__DIR__
).'/Resources/public'
108 # //XXX: get path with bundles/<alias> or full path if not installed
109 # //XXX: current working directory may be project dir or public subdir depending on context
110 # 'path' => is_link(($prefix = is_dir('public') ? './public/' : './').($link = 'bundles/'.str_replace('_', '', $alias))) && is_dir(realpath($prefix.$link)) || is_dir($prefix.$link) ? $link : dirname(__DIR__).'/Resources/public',
111 # 'url' => '/bundles/'.str_replace('_', '', $alias)
115 //Here we define the parameters that are allowed to configure the bundle.
116 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
117 //TODO: see http://symfony.com/doc/current/components/config/definition.html
118 //XXX: use bin/console config:dump-reference to dump class infos
120 //Here we define the parameters that are allowed to configure the bundle.
124 ->addDefaultsIfNotSet()
127 ->addDefaultsIfNotSet()
129 ->scalarNode('donate')->cannotBeEmpty()->defaultValue($defaults['site']['donate'])->end()
132 ->defaultValue($defaults['site']['icon'])
133 ->scalarPrototype()->end()
137 ->defaultValue($defaults['site']['logo'])
138 ->scalarPrototype()->end()
142 ->defaultValue($defaults['site']['png'])
143 ->scalarPrototype()->end()
145 /*->scalarNode('ico')->cannotBeEmpty()->defaultValue($defaults['site']['ico'])->end()
146 ->scalarNode('logo')->cannotBeEmpty()->defaultValue($defaults['site']['logo'])->end()
147 ->scalarNode('svg')->cannotBeEmpty()->defaultValue($defaults['site']['svg'])->end()*/
148 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['site']['title'])->end()
149 ->scalarNode('url')->cannotBeEmpty()->defaultValue($defaults['site']['url'])->end()
152 ->arrayNode('calendar')
153 ->addDefaultsIfNotSet()
155 ->scalarNode('calendar')->defaultValue($defaults['calendar']['calendar'])->end()
156 ->scalarNode('prefix')->defaultValue($defaults['calendar']['prefix'])->end()
157 ->scalarNode('project')->defaultValue($defaults['calendar']['project'])->end()
158 ->scalarNode('client')->defaultValue($defaults['calendar']['client'])->end()
159 ->scalarNode('secret')->defaultValue($defaults['calendar']['secret'])->end()
163 ->addDefaultsIfNotSet()
165 ->scalarNode('by')->defaultValue($defaults['copy']['by'])->end()
166 ->scalarNode('link')->defaultValue($defaults['copy']['link'])->end()
167 ->scalarNode('long')->defaultValue($defaults['copy']['long'])->end()
168 ->scalarNode('short')->defaultValue($defaults['copy']['short'])->end()
169 ->scalarNode('title')->defaultValue($defaults['copy']['title'])->end()
172 ->arrayNode('contact')
173 ->addDefaultsIfNotSet()
175 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['contact']['title'])->end()
176 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
179 ->arrayNode('facebook')
180 ->addDefaultsIfNotSet()
184 ->defaultValue($defaults['facebook']['apps'])
185 ->scalarPrototype()->end()
187 ->integerNode('height')->min(0)->defaultValue($defaults['facebook']['height'])->end()
188 ->integerNode('width')->min(0)->defaultValue($defaults['facebook']['width'])->end()
191 ->scalarNode('locale')->cannotBeEmpty()->defaultValue($defaults['locale'])->end()
192 #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false)
193 #->scalarNode('locales')->cannotBeEmpty()->defaultValue($defaults['locales'])->end()
194 ->variableNode('locales')
196 ->defaultValue($defaults['locales'])
197 #->scalarPrototype()->end()
199 #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false)
200 #->scalarNode('languages')->cannotBeEmpty()->defaultValue($defaults['languages'])->end()
201 ->variableNode('languages')
203 ->defaultValue($defaults['languages'])
204 #->scalarPrototype()->end()
206 ->scalarNode('path')->defaultValue($defaults['path'])->end()
207 #->arrayNode('public')
208 # ->addDefaultsIfNotSet()
210 # ->scalarNode('path')->defaultValue($defaults['public']['path'])->end()
211 # ->scalarNode('url')->defaultValue($defaults['public']['url'])->end()