public function TwigExtensionPass::process
public TwigExtensionPass::process(ContainerBuilder $container)
You can modify the container here before it is dumped to PHP code.
Parameters
ContainerBuilder $container:
Overrides CompilerPassInterface::process
File
- core/lib/Drupal/Core/DependencyInjection/Compiler/TwigExtensionPass.php, line 19
Class
- TwigExtensionPass
- Adds the twig_extension_hash parameter to the container.
Namespace
Drupal\Core\DependencyInjection\CompilerCode
public function process(ContainerBuilder $container) { $twig_extension_hash = ''; foreach (array_keys($container->findTaggedServiceIds('twig.extension')) as $service_id) { $class_name = $container->getDefinition($service_id)->getClass(); $reflection = new \ReflectionClass($class_name); // We use the class names as hash in order to invalidate on new extensions // and mtime for every time we change an existing file. $twig_extension_hash .= $class_name . filemtime($reflection->getFileName()); } $container->setParameter('twig_extension_hash', hash('crc32b', $twig_extension_hash)); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!DependencyInjection!Compiler!TwigExtensionPass.php/function/TwigExtensionPass::process/8.1.x