1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys AirBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\AirBundle\DependencyInjection
;
14 use Symfony\Component\Config\Definition\Builder\TreeBuilder
;
15 use Symfony\Component\Config\Definition\ConfigurationInterface
;
17 use Rapsys\AirBundle\RapsysAirBundle
;
20 * This is the class that validates and merges configuration from your app/config files.
22 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
24 class Configuration
implements ConfigurationInterface
{
28 public function getConfigTreeBuilder(): TreeBuilder
{
29 $treeBuilder = new TreeBuilder($alias = RapsysAirBundle
::getAlias());
31 // Here you should define the parameters that are allowed to
32 // configure your bundle. See the documentation linked above for
33 // more information on that topic.
37 'address' => 'contact@airlibre.eu',
42 'link' => 'https://rapsys.eu',
43 'long' => 'All rights reserved',
44 'short' => 'Copyright 2019-2021',
47 'donate' => 'https://paypal.me/milongaraphael',
49 'apps' => [3728770287223690],
54 'ico' => '@RapsysAir/ico/icon.ico',
56 //XXX: see https://www.emergeinteractive.com/insights/detail/the-essentials-of-favicons/
57 //XXX: see https://caniuse.com/#feat=link-icon-svg
60 256 => '@RapsysAir/png/icon.256.png',
63 //Chrome for Android home screen icon
64 196 => '@RapsysAir/png/icon.196.png',
65 //Google Developer Web App Manifest Recommendation
66 192 => '@RapsysAir/png/icon.192.png',
67 //Chrome Web Store icon
68 128 => '@RapsysAir/png/icon.128.png',
71 32 => '@RapsysAir/png/icon.32.png',
74 //XXX: old obsolete format: [57, 72, 76, 114, 120, 144]
75 //XXX: see https://webhint.io/docs/user-guide/hints/hint-apple-touch-icons/
76 //XXX: see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
78 180 => '@RapsysAir/png/icon.180.png',
79 //iPad Retina touch icon
80 167 => '@RapsysAir/png/icon.167.png',
82 152 => '@RapsysAir/png/icon.152.png',
84 120 => '@RapsysAir/png/icon.120.png',
87 //XXX: see https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/dn255024(v=vs.85)
88 310 => '@RapsysAir/png/icon.310.png',
89 150 => '@RapsysAir/png/icon.150.png',
90 70 => '@RapsysAir/png/icon.70.png'
92 'svg' => '@RapsysAir/svg/icon.svg'
94 //XXX: revert to underscore because of that shit:
95 //XXX: see https://symfony.com/doc/current/components/config/definition.html#normalization
96 //XXX: see https://github.com/symfony/symfony/issues/7405
97 //TODO: copy to '%rapsys_user.languages%',
101 //TODO: copy to '%kernel.default_locale%'
103 //TODO: copy to '%kernel.translator.fallbacks%'
104 'locales' => [ 'en_gb' ],
106 'alt' => 'Libre Air\'s booking system logo',
107 'png' => '@RapsysAir/png/logo.png',
108 'svg' => '@RapsysAir/svg/logo.svg'
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 'root' => 'rapsys_air',
112 'title' => 'Libre Air\'s booking system'
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()
126 ->arrayNode('contact')
127 ->addDefaultsIfNotSet()
129 ->scalarNode('address')->cannotBeEmpty()->defaultValue($defaults['contact']['address'])->end()
130 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['contact']['name'])->end()
134 ->addDefaultsIfNotSet()
136 ->scalarNode('by')->defaultValue($defaults['copy']['by'])->end()
137 ->scalarNode('link')->defaultValue($defaults['copy']['link'])->end()
138 ->scalarNode('long')->defaultValue($defaults['copy']['long'])->end()
139 ->scalarNode('short')->defaultValue($defaults['copy']['short'])->end()
140 ->scalarNode('title')->defaultValue($defaults['copy']['title'])->end()
143 ->scalarNode('donate')->cannotBeEmpty()->defaultValue($defaults['donate'])->end()
144 ->arrayNode('facebook')
145 ->addDefaultsIfNotSet()
149 ->defaultValue($defaults['facebook']['apps'])
150 ->scalarPrototype()->end()
152 ->integerNode('height')->min(0)->defaultValue($defaults['facebook']['height'])->end()
153 ->integerNode('width')->min(0)->defaultValue($defaults['facebook']['width'])->end()
157 ->addDefaultsIfNotSet()
159 ->scalarNode('ico')->defaultValue($defaults['icon']['ico'])->end()
160 ->scalarNode('png')->defaultValue($defaults['icon']['png'])->end()
161 ->scalarNode('svg')->defaultValue($defaults['icon']['svg'])->end()
164 #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false)
165 #->scalarNode('languages')->cannotBeEmpty()->defaultValue($defaults['languages'])->end()
166 ->variableNode('languages')
168 ->defaultValue($defaults['languages'])
169 #->scalarPrototype()->end()
171 ->scalarNode('locale')->cannotBeEmpty()->defaultValue($defaults['locale'])->end()
172 #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false)
173 #->scalarNode('locales')->cannotBeEmpty()->defaultValue($defaults['locales'])->end()
174 ->variableNode('locales')
176 ->defaultValue($defaults['locales'])
177 #->scalarPrototype()->end()
180 ->addDefaultsIfNotSet()
182 ->scalarNode('alt')->defaultValue($defaults['logo']['alt'])->end()
183 ->scalarNode('png')->defaultValue($defaults['logo']['png'])->end()
184 ->scalarNode('svg')->defaultValue($defaults['logo']['svg'])->end()
187 ->scalarNode('path')->defaultValue($defaults['path'])->end()
188 ->scalarNode('root')->cannotBeEmpty()->defaultValue($defaults['root'])->end()
189 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['title'])->end()