[TwigBundle] added configuration docs

This commit is contained in:
kbond 2011-06-06 16:08:45 -04:00 committed by Kevin Bond
parent 8dc40e4d29
commit 58939f16f3

View File

@ -56,6 +56,7 @@ class Configuration implements ConfigurationInterface
->arrayNode('resources') ->arrayNode('resources')
->addDefaultsIfNotSet() ->addDefaultsIfNotSet()
->defaultValue(array('form_div_layout.html.twig')) ->defaultValue(array('form_div_layout.html.twig'))
->setExample(array('MyBundle::form.html.twig'))
->validate() ->validate()
->ifTrue(function($v) { return !in_array('form_div_layout.html.twig', $v); }) ->ifTrue(function($v) { return !in_array('form_div_layout.html.twig', $v); })
->then(function($v){ ->then(function($v){
@ -77,6 +78,7 @@ class Configuration implements ConfigurationInterface
->children() ->children()
->arrayNode('globals') ->arrayNode('globals')
->useAttributeAsKey('key') ->useAttributeAsKey('key')
->setExample(array('foo' => '"@bar"', 'pi' => 3.14))
->prototype('array') ->prototype('array')
->beforeNormalization() ->beforeNormalization()
->ifTrue(function($v){ return is_string($v) && 0 === strpos($v, '@'); }) ->ifTrue(function($v){ return is_string($v) && 0 === strpos($v, '@'); })
@ -116,7 +118,7 @@ class Configuration implements ConfigurationInterface
$rootNode $rootNode
->children() ->children()
->scalarNode('autoescape')->end() ->scalarNode('autoescape')->end()
->scalarNode('base_template_class')->end() ->scalarNode('base_template_class')->setExample('Twig_Template')->end()
->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end() ->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end()
->scalarNode('charset')->defaultValue('%kernel.charset%')->end() ->scalarNode('charset')->defaultValue('%kernel.charset%')->end()
->scalarNode('debug')->defaultValue('%kernel.debug%')->end() ->scalarNode('debug')->defaultValue('%kernel.debug%')->end()