Completed
Push — 1.2 ( d3ea0d...d8c512 )
by David
16:21
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 5
Bugs 1 Features 2
Metric Value
wmc 1
c 5
b 1
f 2
lcom 0
cbo 2
dl 0
loc 85
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 77 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata project.
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\DoctrinePHPCRAdminBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * This class contains the configuration information for the bundle
19
 *
20
 * This information is solely responsible for how the different configuration
21
 * sections are normalized, and merged.
22
 *
23
 * @author Michael Williams <[email protected]>
24
 */
25
class Configuration implements ConfigurationInterface
26
{
27
    /**
28
     * Generates the configuration tree.
29
     *
30
     * @return TreeBuilder
31
     */
32
    public function getConfigTreeBuilder()
33
    {
34
        $treeBuilder = new TreeBuilder();
35
        $rootNode = $treeBuilder->root('sonata_doctrine_phpcr_admin', 'array');
36
37
        $rootNode
38
            ->fixXmlConfig('document_tree_default')
39
            ->fixXmlConfig('template')
40
            ->children()
41
                ->arrayNode('templates')
42
                    ->addDefaultsIfNotSet()
43
                    ->children()
44
                        ->arrayNode('form')
45
                            ->prototype('scalar')->end()
46
                            ->defaultValue(array('SonataDoctrinePHPCRAdminBundle:Form:form_admin_fields.html.twig'))
47
                        ->end()
48
                        ->arrayNode('filter')
49
                            ->prototype('scalar')->end()
50
                            ->defaultValue(array('SonataDoctrinePHPCRAdminBundle:Form:filter_admin_fields.html.twig'))
51
                        ->end()
52
                        ->arrayNode('types')
53
                            ->children()
54
                                ->arrayNode('list')
55
                                    ->useAttributeAsKey('name')
56
                                    ->prototype('scalar')->end()
57
                                ->end()
58
                                ->arrayNode('show')
59
                                    ->useAttributeAsKey('name')
60
                                    ->prototype('scalar')->end()
61
                                ->end()
62
                            ->end()
63
                        ->end()
64
                        ->scalarNode('pager_results')->defaultValue('SonataDoctrinePHPCRAdminBundle:Pager:simple_pager_results.html.twig')->cannotBeEmpty()->end()
65
                    ->end()
66
                ->end()
67
                ->arrayNode('document_tree')
68
                    ->useAttributeAsKey('class')
69
                    ->prototype('array')
70
                        ->fixXmlConfig('valid_child', 'valid_children')
71
                        ->children()
72
                            ->arrayNode('valid_children')
73
                                ->prototype('scalar')->end()
74
                                ->info('class names of valid children, manage tree operations for them and hide other children')
75
                            ->end()
76
                            ->scalarNode('image')
77
                                ->defaultValue('')
78
                            ->end()
79
                        ->end()
80
                    ->end()
81
                 ->end()
82
83
                ->arrayNode('document_tree_defaults')
84
                    ->prototype('scalar')->end()
85
                ->end()
86
87
                ->arrayNode('document_tree_options')
88
                    ->addDefaultsIfNotSet()
89
                    ->children()
90
                        ->integerNode('depth')
91
                            ->defaultValue(1)
92
                            ->info('Depth to which to fetch tree children when rendering the initial tree')
93
                        ->end()
94
                        ->scalarNode('precise_children')
95
                            ->defaultTrue()
96
                            ->info('Exact check if document has children. For large trees, set to false for better performance, but user might needs to click on expand to see there are no children.')
97
                        ->end()
98
                        ->booleanNode('confirm_move')
99
                            ->defaultTrue()
100
                            ->info('Whether moving a node in the tree asks for confirmation.')
101
                        ->end()
102
                    ->end()
103
                ->end()
104
            ->end()
105
        ;
106
107
        return $treeBuilder;
108
    }
109
}
110
111