/
FormPass.php
37 lines (31 loc) · 1022 Bytes
/
FormPass.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*
* This file is part of the Symfony package.
*
* (c) Olivier Chauvel <olivier@generation-multiple.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Genemu\Bundle\FormBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Add a new twig.form.resources
*
* @author Olivier Chauvel <olivier@generation-multiple.com>
*/
class FormPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
$resources = $container->getParameter('twig.form.resources');
foreach (array('div', 'jquery', 'stylesheet') as $template) {
$resources[] = 'GenemuFormBundle:Form:' . $template . '_layout.html.twig';
}
$container->setParameter('twig.form.resources', $resources);
}
}