Adds an option to renew the code (fixes #43)

This commit is contained in:
Gregwar
2012-12-25 20:07:00 +01:00
parent 6b340eb258
commit 35405aca2e
6 changed files with 19 additions and 1 deletions

View File

@ -28,6 +28,7 @@ class Configuration implements ConfigurationInterface
->scalarNode('charset')->defaultValue('abcdefhjkmnprstuvwxyz23456789')->end()
->scalarNode('as_file')->defaultValue(false)->end()
->scalarNode('as_url')->defaultValue(false)->end()
->scalarNode('reload')->defaultValue(false)->end()
->scalarNode('image_folder')->defaultValue('captcha')->end()
->scalarNode('web_path')->defaultValue('%kernel.root_dir%/../web')->end()
->scalarNode('gc_freq')->defaultValue(100)->end()

View File

@ -33,6 +33,10 @@ class GregwarCaptchaExtension extends Extension
$container->setParameter('gregwar_captcha.config.expiration', $config['expiration']);
$container->setParameter('gregwar_captcha.config.whitelist_key', $config['whitelist_key']);
if ($config['reload'] && !$config['as_url']) {
throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information');
}
$resources = $container->getParameter('twig.form.resources');
$container->setParameter('twig.form.resources', array_merge(array('GregwarCaptchaBundle::captcha.html.twig'), $resources));
}