forked from KnpLabs/KnpMenuBundle
/
Configuration.php
54 lines (49 loc) · 1.75 KB
/
Configuration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Knp\Bundle\MenuBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This class contains the configuration information for the bundle
*
* @author Christophe Coevoet <stof@notk.org>
*/
class Configuration implements ConfigurationInterface
{
/**
* Generates the configuration tree.
*
* @return TreeBuilder
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('knp_menu');
$rootNode
->fixXmlConfig('provider')
->fixXmlConfig('default_menu_option')
->children()
->arrayNode('providers')
->addDefaultsIfNotSet()
->children()
->booleanNode('builder_alias')->defaultTrue()->end()
->booleanNode('container_aware')->defaultTrue()->end()
->end()
->end()
->arrayNode('twig')
->addDefaultsIfNotSet()
->canBeUnset()
->children()
->scalarNode('template')->defaultValue('knp_menu.html.twig')->end()
->end()
->end()
->booleanNode('templating')->defaultFalse()->end()
->scalarNode('default_renderer')->cannotBeEmpty()->defaultValue('twig')->end()
->arrayNode('default_menu_options')
->useAttributeAsKey('name')
->normalizeKeys(false)
->prototype('scalar')->end()
->end()
->end();
return $treeBuilder;
}
}