]> Raphaël G. Git Repositories - airbundle/blob - DependencyInjection/Configuration.php
Update form names
[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 'copy' => [
70 'by' => 'Created by Raphaël',
71 'link' => 'https://rapsys.eu',
72 'long' => 'All rights reserved',
73 'short' => 'Copyright 2019-2021',
74 'title' => 'Rapsys'
75 ],
76 'contact' => [
77 'name' => 'John Doe',
78 'mail' => 'contact@example.com'
79 ],
80 'locale' => '%kernel.default_locale%',
81 'locales' => '%kernel.translator.fallbacks%',
82 'languages' => '%rapsys_user.languages%',
83 ];
84
85 //Here we define the parameters that are allowed to configure the bundle.
86 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
87 //TODO: see http://symfony.com/doc/current/components/config/definition.html
88 //XXX: use bin/console config:dump-reference to dump class infos
89
90 //Here we define the parameters that are allowed to configure the bundle.
91 $treeBuilder
92 //Parameters
93 ->getRootNode()
94 ->addDefaultsIfNotSet()
95 ->children()
96 ->arrayNode('site')
97 ->addDefaultsIfNotSet()
98 ->children()
99 ->scalarNode('ico')->cannotBeEmpty()->defaultValue($defaults['site']['ico'])->end()
100 ->scalarNode('logo')->cannotBeEmpty()->defaultValue($defaults['site']['logo'])->end()
101 ->arrayNode('png')
102 ->treatNullLike([])
103 ->defaultValue($defaults['site']['png'])
104 ->scalarPrototype()->end()
105 ->end()
106 ->scalarNode('svg')->cannotBeEmpty()->defaultValue($defaults['site']['svg'])->end()
107 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['site']['title'])->end()
108 ->scalarNode('url')->cannotBeEmpty()->defaultValue($defaults['site']['url'])->end()
109 ->end()
110 ->end()
111 ->arrayNode('copy')
112 ->addDefaultsIfNotSet()
113 ->children()
114 ->scalarNode('by')->defaultValue($defaults['copy']['by'])->end()
115 ->scalarNode('link')->defaultValue($defaults['copy']['link'])->end()
116 ->scalarNode('long')->defaultValue($defaults['copy']['long'])->end()
117 ->scalarNode('short')->defaultValue($defaults['copy']['short'])->end()
118 ->scalarNode('title')->defaultValue($defaults['copy']['title'])->end()
119 ->end()
120 ->end()
121 ->arrayNode('contact')
122 ->addDefaultsIfNotSet()
123 ->children()
124 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['contact']['name'])->end()
125 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
126 ->end()
127 ->end()
128 ->scalarNode('locale')->cannotBeEmpty()->defaultValue($defaults['locale'])->end()
129 ->scalarNode('locales')->cannotBeEmpty()->defaultValue($defaults['locales'])->end()
130 ->scalarNode('languages')->cannotBeEmpty()->defaultValue($defaults['languages'])->end()
131 ->end()
132 ->end();
133
134 return $treeBuilder;
135 }
136 }