Add key parameter to URL generation method.

This commit is contained in:
Jeremy Livingston
2012-12-03 14:49:17 -05:00
parent a41e4dd865
commit 9fc82c8453
6 changed files with 34 additions and 33 deletions

View File

@ -15,7 +15,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('gregwar_captcha', 'array');
$rootNode = $treeBuilder->root('gregwar_captcha');
$rootNode
->addDefaultsIfNotSet()
@ -28,7 +28,6 @@ class Configuration implements ConfigurationInterface
->scalarNode('charset')->defaultValue('abcdefhjkmnprstuvwxyz23456789')->end()
->scalarNode('as_file')->defaultValue(false)->end()
->scalarNode('as_url')->defaultValue(false)->end()
->scalarNode('url')->defaultValue('/generate-captcha')->end()
->scalarNode('image_folder')->defaultValue('captcha')->end()
->scalarNode('web_path')->defaultValue('%kernel.root_dir%/../web')->end()
->scalarNode('gc_freq')->defaultValue(100)->end()
@ -36,8 +35,10 @@ class Configuration implements ConfigurationInterface
->scalarNode('quality')->defaultValue(15)->end()
->scalarNode('invalid_message')->defaultValue('Bad code value')->end()
->scalarNode('bypass_code')->defaultValue(null)->end()
->arrayNode('valid_keys')->defaultValue(array('captcha'))->prototype('scalar')->end()
->end()
;
return $treeBuilder;
}
}

View File

@ -31,7 +31,6 @@ class GregwarCaptchaExtension extends Extension
$container->setParameter('gregwar_captcha.config.web_path', $config['web_path']);
$container->setParameter('gregwar_captcha.config.gc_freq', $config['gc_freq']);
$container->setParameter('gregwar_captcha.config.expiration', $config['expiration']);
$container->setParameter('gregwar_captcha.config.url', $config['url']);
$resources = $container->getParameter('twig.form.resources');
$container->setParameter('twig.form.resources', array_merge(array('GregwarCaptchaBundle::captcha.html.twig'), $resources));