Completed
Pull Request — master (#255)
by Piotr
02:58
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 40
Code Lines 35

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 40
c 0
b 0
f 0
rs 8.8571
cc 1
eloc 35
nc 1
nop 0
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace FSi\Bundle\AdminBundle\DependencyInjection;
11
12
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
13
use Symfony\Component\Config\Definition\ConfigurationInterface;
14
15
/**
16
 * @author Norbert Orzechowicz <[email protected]>
17
 */
18
class Configuration implements ConfigurationInterface
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function getConfigTreeBuilder()
24
    {
25
        $treeBuilder = new TreeBuilder();
26
        $rootNode = $treeBuilder->root('fsi_admin');
27
28
        $rootNode
29
            ->children()
30
                ->scalarNode('default_locale')->defaultValue('%locale%')->end()
31
                ->arrayNode('locales')
32
                    ->prototype('scalar')->end()
33
                    ->defaultValue(array('%locale%'))
34
                ->end()
35
                ->scalarNode('menu_config_path')->defaultValue("%kernel.root_dir%/config/admin_menu.yml")->end()
36
                ->arrayNode('templates')
37
                    ->addDefaultsIfNotSet()
38
                    ->children()
39
                        ->scalarNode('base')->defaultValue('@FSiAdmin/base.html.twig')->end()
40
                        ->scalarNode('index_page')->defaultValue('@FSiAdmin/Admin/index.html.twig')->end()
41
                        ->scalarNode('list')->defaultValue('@FSiAdmin/List/list.html.twig')->end()
42
                        ->scalarNode('form')->defaultValue('@FSiAdmin/Form/form.html.twig')->end()
43
                        ->scalarNode('resource')->defaultValue('@FSiAdmin/Resource/resource.html.twig')->end()
44
                        ->scalarNode('display')->defaultValue('@FSiAdmin/Display/display.html.twig')->end()
45
                        ->scalarNode('datagrid_theme')->defaultValue('@FSiAdmin/CRUD/datagrid.html.twig')->end()
46
                        ->scalarNode('datasource_theme')->defaultValue('@FSiAdmin/CRUD/datasource.html.twig')->end()
47
                        ->scalarNode('form_theme')->defaultValue('@FSiAdmin/Form/form_theme.html.twig')->end()
48
                    ->end()
49
                ->end()
50
                ->arrayNode('annotations')
51
                    ->addDefaultsIfNotSet()
52
                    ->children()
53
                        ->arrayNode('dirs')
54
                            ->prototype('scalar')->defaultValue(array())->end()
55
                        ->end()
56
                    ->end()
57
                ->end()
58
            ->end()
59
        ;
60
61
        return $treeBuilder;
62
    }
63
}
64