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\SeoBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
15
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
16
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* This is the class that validates and merges configuration from your app/config files. |
20
|
|
|
*/ |
21
|
|
|
class Configuration implements ConfigurationInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* {@inheritdoc} |
25
|
|
|
*/ |
26
|
|
|
public function getConfigTreeBuilder() |
27
|
|
|
{ |
28
|
|
|
$treeBuilder = new TreeBuilder(); |
29
|
|
|
|
30
|
|
|
$node = $treeBuilder->root('sonata_seo'); |
31
|
|
|
|
32
|
|
|
$node |
33
|
|
|
->children() |
34
|
|
|
->scalarNode('encoding')->defaultValue('UTF-8')->end() |
35
|
|
|
->arrayNode('page') |
36
|
|
|
->addDefaultsIfNotSet() |
37
|
|
|
->children() |
38
|
|
|
->scalarNode('default')->defaultValue('sonata.seo.page.default')->end() |
39
|
|
|
->arrayNode('head') |
40
|
|
|
->normalizeKeys(false) |
41
|
|
|
->useAttributeAsKey('attribute') |
42
|
|
|
->prototype('scalar')->end() |
43
|
|
|
->end() |
44
|
|
|
->arrayNode('metas') |
45
|
|
|
->normalizeKeys(false) |
46
|
|
|
->useAttributeAsKey('element') |
47
|
|
|
->prototype('array') |
48
|
|
|
->normalizeKeys(false) |
49
|
|
|
->useAttributeAsKey('name') |
50
|
|
|
->prototype('scalar')->end() |
51
|
|
|
->end() |
52
|
|
|
->end() |
53
|
|
|
->scalarNode('separator')->defaultValue(' - ')->end() |
54
|
|
|
->scalarNode('title')->defaultValue('Sonata Project')->end() |
55
|
|
|
->end() |
56
|
|
|
->end() |
57
|
|
|
->arrayNode('sitemap') |
58
|
|
|
->addDefaultsIfNotSet() |
59
|
|
|
->children() |
60
|
|
|
->arrayNode('doctrine_orm') |
61
|
|
|
->prototype('variable')->end() |
62
|
|
|
->end() |
63
|
|
|
->arrayNode('services') |
64
|
|
|
->prototype('variable')->end() |
65
|
|
|
->end() |
66
|
|
|
->end() |
67
|
|
|
->end() |
68
|
|
|
->end() |
69
|
|
|
; |
70
|
|
|
|
71
|
|
|
$this->addHTTPlugSection($node); |
72
|
|
|
|
73
|
|
|
return $treeBuilder; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param ArrayNodeDefinition $node |
78
|
|
|
*/ |
79
|
|
|
private function addHTTPlugSection(ArrayNodeDefinition $node) |
80
|
|
|
{ |
81
|
|
|
$node |
82
|
|
|
->children() |
83
|
|
|
->arrayNode('http') |
84
|
|
|
->addDefaultsIfNotSet() |
85
|
|
|
->children() |
86
|
|
|
->scalarNode('client') |
87
|
|
|
->defaultValue('httplug.client.default') |
88
|
|
|
->info('Alias of the HTTPlug client.') |
89
|
|
|
->end() |
90
|
|
|
->scalarNode('message_factory') |
91
|
|
|
->defaultValue('httplug.message_factory.default') |
92
|
|
|
->info('Alias of the HTTPlug message factory.') |
93
|
|
|
->end() |
94
|
|
|
->end() |
95
|
|
|
->end() |
96
|
|
|
->end(); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|