CaptchaBundle/DependencyInjection/GregwarCaptchaExtension.php
2011-09-08 11:02:40 -04:00

31 lines
1.1 KiB
PHP
Executable File

<?php
namespace Gregwar\CaptchaBundle\DependencyInjection;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
class GregwarCaptchaExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter('gregwar_captcha.image.height', $config['image']['height']);
$container->setParameter('gregwar_captcha.image.width', $config['image']['width']);
$resources = $container->getParameter('twig.form.resources');
$container->setParameter('twig.form.resources',array_merge(array('GregwarCaptchaBundle::captcha.html.twig'), $resources));
}
}