1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * This file is part of the TranslationFormBundle package. |
||
7 | * |
||
8 | * (c) David ALLIX <http://a2lix.fr> |
||
9 | * |
||
10 | * For the full copyright and license information, please view the LICENSE |
||
11 | * file that was distributed with this source code. |
||
12 | */ |
||
13 | |||
14 | namespace A2lix\TranslationFormBundle\DependencyInjection; |
||
15 | |||
16 | use A2lix\TranslationFormBundle\DependencyInjection\Compiler\LocaleProviderPass; |
||
17 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||
18 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||
19 | |||
20 | class Configuration implements ConfigurationInterface |
||
21 | { |
||
22 | 1 | public function getConfigTreeBuilder(): TreeBuilder |
|
23 | { |
||
24 | 1 | $treeBuilder = new TreeBuilder('a2lix_translation_form'); |
|
25 | 1 | $rootNode = method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('a2lix_translation_form'); |
|
0 ignored issues
–
show
|
|||
26 | |||
27 | $rootNode |
||
28 | 1 | ->children() |
|
29 | 1 | ->scalarNode('locale_provider') |
|
30 | 1 | ->defaultValue(LocaleProviderPass::DEFAULT_LOCALE_PROVIDER_KEY) |
|
31 | 1 | ->info('Set your own LocaleProvider service identifier if required') |
|
32 | 1 | ->end() |
|
33 | 1 | ->scalarNode('default_locale') |
|
34 | 1 | ->defaultNull() |
|
35 | 1 | ->info('Set your own default locale if different from the SymfonyFramework locale. eg: en') |
|
36 | 1 | ->end() |
|
37 | 1 | ->arrayNode('locales') |
|
38 | 1 | ->beforeNormalization() |
|
39 | 1 | ->ifString() |
|
40 | 1 | ->then(function ($v) { |
|
41 | return preg_split('/\s*,\s*/', $v); |
||
42 | 1 | }) |
|
43 | 1 | ->end() |
|
44 | 1 | ->requiresAtLeastOneElement() |
|
45 | 1 | ->prototype('scalar')->end() |
|
46 | 1 | ->info('Set the list of locales to manage (default locale included). eg: [en, fr, de, es]') |
|
47 | 1 | ->end() |
|
48 | 1 | ->arrayNode('required_locales') |
|
49 | 1 | ->beforeNormalization() |
|
50 | 1 | ->ifString() |
|
51 | 1 | ->then(function ($v) { |
|
52 | return preg_split('/\s*,\s*/', $v); |
||
53 | 1 | }) |
|
54 | 1 | ->end() |
|
55 | 1 | ->prototype('scalar')->end() |
|
56 | 1 | ->info('Set the list of required locales to manage. eg: [en]') |
|
57 | 1 | ->end() |
|
58 | 1 | ->scalarNode('templating') |
|
59 | 1 | ->defaultValue('@A2lixTranslationForm/bootstrap_4_layout.html.twig') |
|
60 | 1 | ->info('Set your own template path if required') |
|
61 | 1 | ->end() |
|
62 | 1 | ->end() |
|
63 | ; |
||
64 | |||
65 | 1 | return $treeBuilder; |
|
66 | } |
||
67 | } |
||
68 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.