1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kunstmaan\NodeBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
6
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
7
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* This is the class that validates and merges configuration from your app/config files |
11
|
|
|
* |
12
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
13
|
|
|
*/ |
14
|
|
|
class Configuration implements ConfigurationInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* {@inheritdoc} |
18
|
|
|
*/ |
19
|
|
|
public function getConfigTreeBuilder() |
20
|
|
|
{ |
21
|
|
|
$treeBuilder = new TreeBuilder('kunstmaan_node'); |
22
|
|
|
if (method_exists($treeBuilder, 'getRootNode')) { |
23
|
|
|
$rootNode = $treeBuilder->getRootNode(); |
24
|
|
|
} else { |
25
|
|
|
// BC layer for symfony/config 4.1 and older |
26
|
|
|
$rootNode = $treeBuilder->root('kunstmaan_node'); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/* @var ArrayNodeDefinition $pages */ |
30
|
|
|
$rootNode |
31
|
|
|
->children() |
32
|
|
|
->arrayNode('pages') |
33
|
|
|
->prototype('array') |
34
|
|
|
->children() |
35
|
|
|
->scalarNode('name')->isRequired()->end() |
36
|
|
|
->scalarNode('search_type')->end() |
37
|
|
|
->booleanNode('structure_node')->end() |
38
|
|
|
->booleanNode('indexable')->end() |
39
|
|
|
->scalarNode('icon')->defaultNull()->end() |
40
|
|
|
->scalarNode('hidden_from_tree')->end() |
41
|
|
|
->booleanNode('is_homepage')->end() |
42
|
|
|
->arrayNode('allowed_children') |
43
|
|
|
->prototype('array') |
44
|
|
|
->beforeNormalization() |
45
|
|
|
->ifString()->then(function ($v) { |
46
|
|
|
return ['class' => $v]; |
47
|
|
|
}) |
48
|
|
|
->end() |
49
|
|
|
->children() |
50
|
|
|
->scalarNode('class')->isRequired()->end() |
51
|
|
|
->scalarNode('name')->end() |
52
|
|
|
->end() |
53
|
|
|
->end() |
54
|
|
|
->end() |
55
|
|
|
->end() |
56
|
|
|
->end() |
57
|
|
|
->end() |
58
|
|
|
->scalarNode('publish_later_stepping')->defaultValue('15')->end() |
59
|
|
|
->scalarNode('unpublish_later_stepping')->defaultValue('15')->end() |
60
|
|
|
->booleanNode('show_add_homepage')->defaultTrue()->end() |
61
|
|
|
->booleanNode('enable_export_page_template')->defaultFalse()->end() |
62
|
|
|
->arrayNode('lock') |
63
|
|
|
->addDefaultsIfNotSet() |
64
|
|
|
->canBeEnabled() |
65
|
|
|
->children() |
66
|
|
|
->scalarNode('check_interval')->defaultValue(15)->end() |
67
|
|
|
->scalarNode('threshold')->defaultValue(35)->end() |
68
|
|
|
->booleanNode('enabled')->defaultFalse()->end() |
69
|
|
|
->end() |
70
|
|
|
->end() |
71
|
|
|
->end(); |
72
|
|
|
|
73
|
|
|
return $treeBuilder; |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|