Configuration.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Knp\Bundle\MenuBundle\DependencyInjection;
  3. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  4. use Symfony\Component\Config\Definition\ConfigurationInterface;
  5. /**
  6. * This class contains the configuration information for the bundle
  7. *
  8. * @author Christophe Coevoet <stof@notk.org>
  9. */
  10. class Configuration implements ConfigurationInterface
  11. {
  12. /**
  13. * Generates the configuration tree.
  14. *
  15. * @return TreeBuilder
  16. */
  17. public function getConfigTreeBuilder()
  18. {
  19. $treeBuilder = new TreeBuilder();
  20. $rootNode = $treeBuilder->root('knp_menu');
  21. $rootNode
  22. ->children()
  23. ->arrayNode('providers')
  24. ->addDefaultsIfNotSet()
  25. ->children()
  26. ->booleanNode('builder_alias')->defaultTrue()->end()
  27. ->booleanNode('container_aware')->defaultTrue()->end()
  28. ->end()
  29. ->end()
  30. ->arrayNode('twig')
  31. ->addDefaultsIfNotSet()
  32. ->canBeUnset()
  33. ->children()
  34. ->scalarNode('template')->defaultValue('knp_menu.html.twig')->end()
  35. ->end()
  36. ->end()
  37. ->booleanNode('templating')->defaultFalse()->end()
  38. ->scalarNode('default_renderer')->cannotBeEmpty()->defaultValue('twig')->end()
  39. ->end();
  40. return $treeBuilder;
  41. }
  42. }