open-orchestra/open-orchestra-cms-bundle

View on GitHub
WorkflowAdminBundle/DependencyInjection/Compiler/TwigGlobalsCompilerPass.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace OpenOrchestra\WorkflowAdminBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Class TwigGlobalsCompilerPass
 */
class TwigGlobalsCompilerPass implements CompilerPassInterface
{
    /**
     * You can modify the container here before it is dumped to PHP code.
     *
     * @param ContainerBuilder $container
     *
     * @api
     */
    public function process(ContainerBuilder $container)
    {
        if ($container->hasDefinition('twig')) {
            $formResources = $container->getParameter('twig.form.resources');
            $formResources[] = 'OpenOrchestraWorkflowAdminBundle:Form:form_div_layout.html.twig';
            $container->setParameter('twig.form.resources', $formResources);
        }
    }
}