Configuration.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /*
  3. * This file is part of the Sonata project.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\DoctrineORMAdminBundle\DependencyInjection;
  11. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  12. use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
  13. use Symfony\Component\Config\Definition\ConfigurationInterface;
  14. /**
  15. * This class contains the configuration information for the bundle
  16. *
  17. * This information is solely responsible for how the different configuration
  18. * sections are normalized, and merged.
  19. *
  20. * @author Michael Williams <mtotheikle@gmail.com>
  21. */
  22. class Configuration implements ConfigurationInterface
  23. {
  24. /**
  25. * Generates the configuration tree.
  26. *
  27. * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder
  28. */
  29. public function getConfigTreeBuilder()
  30. {
  31. $treeBuilder = new TreeBuilder();
  32. $rootNode = $treeBuilder->root('sonata_doctrine_orm_admin', 'array');
  33. $rootNode
  34. ->children()
  35. ->scalarNode('entity_manager')->defaultNull()->end()
  36. ->scalarNode('versioning')->defaultValue(true)->end()
  37. ->arrayNode('templates')
  38. ->addDefaultsIfNotSet()
  39. ->children()
  40. ->arrayNode('form')
  41. ->prototype('scalar')->end()
  42. ->defaultValue(array('SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig'))
  43. ->end()
  44. ->arrayNode('filter')
  45. ->prototype('scalar')->end()
  46. ->defaultValue(array('SonataDoctrineORMAdminBundle:Form:filter_admin_fields.html.twig'))
  47. ->end()
  48. ->arrayNode('types')
  49. ->children()
  50. ->arrayNode('list')
  51. ->useAttributeAsKey('name')
  52. ->prototype('scalar')->end()
  53. ->end()
  54. ->arrayNode('show')
  55. ->useAttributeAsKey('name')
  56. ->prototype('scalar')->end()
  57. ->end()
  58. ->end()
  59. ->end()
  60. ->end()
  61. ->end()
  62. ->end()
  63. ;
  64. return $treeBuilder;
  65. }
  66. }