Configuration.php 2.4 KB

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