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 'client' => '%env(string:GOOGLE_CLIENT)',
79 'project' => '%env(string:GOOGLE_PROJECT)',
80 'secret' => '%env(string:GOOGLE_SECRET)'
84 'link' => 'https://rapsys.eu',
85 'long' => 'All rights reserved',
86 'short' => 'Copyright 2019-2021',
90 'title' => 'Libre Air',
91 'mail' => 'contact@airlibre.eu'
94 'apps' => [3728770287223690],
98 'locale' => '%kernel.default_locale%',
99 'locales' => '%kernel.translator.fallbacks%',
100 //XXX: revert to underscore because of that shit:
101 //XXX: see https://symfony.com/doc/current/components/config/definition.html#normalization
102 //XXX: see https://github.com/symfony/symfony/issues/7405
103 'languages' => '%rapsys_user.languages%',
104 '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'
106 # //XXX: get path with bundles/<alias> or full path if not installed
107 # //XXX: current working directory may be project dir or public subdir depending on context
108 # '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',
109 # 'url' => '/bundles/'.str_replace('_', '', $alias)
113 //Here we define the parameters that are allowed to configure the bundle.
114 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
115 //TODO: see http://symfony.com/doc/current/components/config/definition.html
116 //XXX: use bin/console config:dump-reference to dump class infos
118 //Here we define the parameters that are allowed to configure the bundle.
122 ->addDefaultsIfNotSet()
125 ->addDefaultsIfNotSet()
127 ->scalarNode('donate')->cannotBeEmpty()->defaultValue($defaults['site']['donate'])->end()
130 ->defaultValue($defaults['site']['icon'])
131 ->scalarPrototype()->end()
135 ->defaultValue($defaults['site']['logo'])
136 ->scalarPrototype()->end()
140 ->defaultValue($defaults['site']['png'])
141 ->scalarPrototype()->end()
143 /*->scalarNode('ico')->cannotBeEmpty()->defaultValue($defaults['site']['ico'])->end()
144 ->scalarNode('logo')->cannotBeEmpty()->defaultValue($defaults['site']['logo'])->end()
145 ->scalarNode('svg')->cannotBeEmpty()->defaultValue($defaults['site']['svg'])->end()*/
146 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['site']['title'])->end()
147 ->scalarNode('url')->cannotBeEmpty()->defaultValue($defaults['site']['url'])->end()
150 ->arrayNode('google')
151 ->addDefaultsIfNotSet()
153 ->scalarNode('client')->defaultValue($defaults['google']['client'])->end()
154 ->scalarNode('project')->defaultValue($defaults['google']['project'])->end()
155 ->scalarNode('secret')->defaultValue($defaults['google']['secret'])->end()
159 ->addDefaultsIfNotSet()
161 ->scalarNode('by')->defaultValue($defaults['copy']['by'])->end()
162 ->scalarNode('link')->defaultValue($defaults['copy']['link'])->end()
163 ->scalarNode('long')->defaultValue($defaults['copy']['long'])->end()
164 ->scalarNode('short')->defaultValue($defaults['copy']['short'])->end()
165 ->scalarNode('title')->defaultValue($defaults['copy']['title'])->end()
168 ->arrayNode('contact')
169 ->addDefaultsIfNotSet()
171 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['contact']['title'])->end()
172 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
175 ->arrayNode('facebook')
176 ->addDefaultsIfNotSet()
180 ->defaultValue($defaults['facebook']['apps'])
181 ->scalarPrototype()->end()
183 ->integerNode('height')->min(0)->defaultValue($defaults['facebook']['height'])->end()
184 ->integerNode('width')->min(0)->defaultValue($defaults['facebook']['width'])->end()
187 ->scalarNode('locale')->cannotBeEmpty()->defaultValue($defaults['locale'])->end()
188 #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false)
189 #->scalarNode('locales')->cannotBeEmpty()->defaultValue($defaults['locales'])->end()
190 ->variableNode('locales')
192 ->defaultValue($defaults['locales'])
193 #->scalarPrototype()->end()
195 #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false)
196 #->scalarNode('languages')->cannotBeEmpty()->defaultValue($defaults['languages'])->end()
197 ->variableNode('languages')
199 ->defaultValue($defaults['languages'])
200 #->scalarPrototype()->end()
202 ->scalarNode('path')->defaultValue($defaults['path'])->end()
203 #->arrayNode('public')
204 # ->addDefaultsIfNotSet()
206 # ->scalarNode('path')->defaultValue($defaults['public']['path'])->end()
207 # ->scalarNode('url')->defaultValue($defaults['public']['url'])->end()