Completed
Push — master ( 9ec196...c21c38 )
by Alex
11:51
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 47
Code Lines 41

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 3
Metric Value
c 5
b 0
f 3
dl 0
loc 47
rs 9.0303
cc 1
eloc 41
nc 1
nop 0
1
<?php
2
3
/*
4
* This file is part of the OrbitaleCmsBundle package.
5
*
6
* (c) Alexandre Rock Ancelet <[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 Orbitale\Bundle\CmsBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * This is the class that validates and merges configuration from your app/config files.
19
 *
20
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function getConfigTreeBuilder()
28
    {
29
        $treeBuilder = new TreeBuilder();
30
        $rootNode = $treeBuilder->root('orbitale_cms');
31
32
        $rootNode
33
            ->children()
34
                ->arrayNode('layouts')
35
                    ->defaultValue(array(
36
                        'front' => array(
37
                            'resource' => 'OrbitaleCmsBundle::default_layout.html.twig',
38
                            'pattern' => '^/',
39
                        ),
40
                    ))
41
                    ->useAttributeAsKey('name')
42
                    ->prototype('array')
43
                        ->children()
44
                            ->scalarNode('name')->end()
45
                            ->scalarNode('resource')->isRequired()->end()
46
                            ->arrayNode('assets_css')->end()
47
                            ->arrayNode('assets_js')->end()
48
                            ->scalarNode('pattern')->end()
49
                            ->scalarNode('host')->end()
50
                        ->end()
51
                    ->end()
52
                ->end()
53
                ->arrayNode('design')
54
                    ->addDefaultsIfNotSet()
55
                    ->children()
56
                        ->scalarNode('breadcrumbs_class')->defaultValue('breadcrumb')->end()
57
                        ->scalarNode('breadcrumbs_link_class')->defaultValue('')->end()
58
                        ->scalarNode('breadcrumbs_current_class')->defaultValue('')->end()
59
                        ->scalarNode('breadcrumbs_separator')->defaultValue('>')->end()
60
                        ->scalarNode('breadcrumbs_separator_class')->defaultValue('breadcrumb-separator')->end()
61
                    ->end()
62
                ->end()
63
                ->arrayNode('cache')
64
                    ->addDefaultsIfNotSet()
65
                    ->children()
66
                        ->booleanNode('enabled')->defaultFalse()->end()
67
                        ->scalarNode('ttl')->defaultValue('300')->end()
68
                    ->end()
69
                ->end()
70
            ->end();
71
72
        return $treeBuilder;
73
    }
74
}
75