1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sonata Project package. |
5
|
|
|
* |
6
|
|
|
* (c) Thomas Rabaix <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Sonata\TranslationBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
15
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @author Nicolas Bastien <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
class Configuration implements ConfigurationInterface |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* {@inheritdoc} |
24
|
|
|
*/ |
25
|
|
|
public function getConfigTreeBuilder() |
26
|
|
|
{ |
27
|
|
|
$treeBuilder = new TreeBuilder(); |
28
|
|
|
$rootNode = $treeBuilder->root('sonata_translation'); |
29
|
|
|
|
30
|
|
|
$rootNode |
31
|
|
|
->children() |
32
|
|
|
->arrayNode('locales') |
33
|
|
|
->info('The list of your frontend locales in which your models will be translatable.') |
34
|
|
|
->requiresAtLeastOneElement() |
35
|
|
|
->prototype('scalar')->end() |
36
|
|
|
->end() |
37
|
|
|
->scalarNode('default_locale') |
38
|
|
|
->defaultValue('en') |
39
|
|
|
->info('The frontend locale that is used by default.') |
40
|
|
|
->end() |
41
|
|
|
->arrayNode('gedmo') |
42
|
|
|
->canBeEnabled() |
43
|
|
|
->children() |
44
|
|
|
->arrayNode('implements') |
45
|
|
|
->requiresAtLeastOneElement() |
46
|
|
|
->prototype('scalar')->end() |
47
|
|
|
->end() |
48
|
|
|
->arrayNode('instanceof') |
49
|
|
|
->requiresAtLeastOneElement() |
50
|
|
|
->prototype('scalar')->end() |
51
|
|
|
->end() |
52
|
|
|
->end() |
53
|
|
|
->end() |
54
|
|
|
->arrayNode('knplabs') |
55
|
|
|
->canBeEnabled() |
56
|
|
|
->children() |
57
|
|
|
->arrayNode('implements') |
58
|
|
|
->requiresAtLeastOneElement() |
59
|
|
|
->prototype('scalar')->end() |
60
|
|
|
->end() |
61
|
|
|
->arrayNode('instanceof') |
62
|
|
|
->requiresAtLeastOneElement() |
63
|
|
|
->prototype('scalar')->end() |
64
|
|
|
->end() |
65
|
|
|
->end() |
66
|
|
|
->end() |
67
|
|
|
->arrayNode('phpcr') |
68
|
|
|
->canBeEnabled() |
69
|
|
|
->children() |
70
|
|
|
->arrayNode('implements') |
71
|
|
|
->requiresAtLeastOneElement() |
72
|
|
|
->prototype('scalar')->end() |
73
|
|
|
->end() |
74
|
|
|
->arrayNode('instanceof') |
75
|
|
|
->requiresAtLeastOneElement() |
76
|
|
|
->prototype('scalar')->end() |
77
|
|
|
->end() |
78
|
|
|
->end() |
79
|
|
|
->end() |
80
|
|
|
->end(); |
81
|
|
|
|
82
|
|
|
return $treeBuilder; |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|