1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Gerard van Helden <[email protected]> |
4
|
|
|
* @copyright Zicht Online <http://zicht.nl> |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace Zicht\Bundle\PageBundle\DependencyInjection; |
8
|
|
|
|
9
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
10
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Page bundle configuration |
14
|
|
|
*/ |
15
|
|
|
class Configuration implements ConfigurationInterface |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @{inheritDoc} |
19
|
|
|
*/ |
20
|
1 |
|
public function getConfigTreeBuilder() |
21
|
|
|
{ |
22
|
1 |
|
$treeBuilder = new TreeBuilder(); |
23
|
1 |
|
$rootNode = $treeBuilder->root('zicht_page'); |
24
|
|
|
|
25
|
|
|
$rootNode |
26
|
1 |
|
->children() |
27
|
1 |
|
->arrayNode('aliasing') |
28
|
1 |
|
->canBeEnabled() |
29
|
1 |
|
->addDefaultsIfNotSet() |
30
|
1 |
|
->children() |
31
|
1 |
|
->scalarNode('service')->defaultValue('zicht_page.page_aliasing_strategy')->end() |
32
|
1 |
|
->arrayNode('prefixLanguages')->prototype('scalar')->end()->end() |
33
|
1 |
|
->scalarNode('conflictingInternalUrlStrategy') |
34
|
1 |
|
->defaultValue('ignore') |
35
|
1 |
|
->validate() |
36
|
1 |
|
->ifNotInArray(['ignore', 'redirect-previous-to-new']) |
37
|
1 |
|
->thenInvalid('Invalid conflictingInternalUrlStrategy') |
38
|
1 |
|
->end() |
39
|
1 |
|
->end() |
40
|
1 |
|
->scalarNode('conflictingPublicUrlStrategy') |
41
|
1 |
|
->defaultValue('suffix') |
42
|
1 |
|
->validate() |
43
|
1 |
|
->ifNotInArray(['keep', 'overwrite', 'suffix']) |
44
|
1 |
|
->thenInvalid('Invalid conflictingPublicUrlStrategy') |
45
|
1 |
|
->end() |
46
|
1 |
|
->end() |
47
|
1 |
|
->end() |
48
|
1 |
|
->end() |
49
|
1 |
|
->arrayNode('types') |
50
|
1 |
|
->isRequired() |
51
|
1 |
|
->children() |
52
|
1 |
|
->arrayNode('page')->prototype('scalar')->isRequired()->end()->end() |
53
|
1 |
|
->arrayNode('contentItem')->prototype('scalar')->isRequired()->end()->end() |
54
|
1 |
|
->end() |
55
|
1 |
|
->end() |
56
|
1 |
|
->scalarNode('pageClass')->isRequired()->end() |
57
|
1 |
|
->scalarNode('contentItemClass')->isRequired()->end() |
58
|
1 |
|
->arrayNode('admin') |
59
|
1 |
|
->children() |
60
|
1 |
|
->arrayNode('base') |
61
|
1 |
|
->children() |
62
|
1 |
|
->scalarNode('page')->end() |
63
|
1 |
|
->scalarNode('contentItem')->end() |
64
|
1 |
|
->end() |
65
|
1 |
|
->end() |
66
|
1 |
|
->end() |
67
|
1 |
|
->end() |
68
|
1 |
|
->arrayNode('defaultRegions')->prototype('scalar')->isRequired()->end()->end() |
69
|
1 |
|
->end(); |
70
|
|
|
|
71
|
1 |
|
return $treeBuilder; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|