Configuration.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. ->arrayNode('templates')
  37. ->addDefaultsIfNotSet()
  38. ->children()
  39. ->arrayNode('form')
  40. ->prototype('scalar')->end()
  41. ->defaultValue(array('SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig'))
  42. ->end()
  43. ->arrayNode('filter')
  44. ->prototype('scalar')->end()
  45. ->defaultValue(array('SonataDoctrineORMAdminBundle:Form:filter_admin_fields.html.twig'))
  46. ->end()
  47. ->arrayNode('types')
  48. ->children()
  49. ->arrayNode('list')
  50. ->useAttributeAsKey('name')
  51. ->prototype('scalar')->end()
  52. ->end()
  53. ->arrayNode('show')
  54. ->useAttributeAsKey('name')
  55. ->prototype('scalar')->end()
  56. ->end()
  57. ->end()
  58. ->end()
  59. ->end()
  60. ->end()
  61. ->end()
  62. ;
  63. return $treeBuilder;
  64. }
  65. }