diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 5bde077..5b9b8b5 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -7,6 +7,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -374,6 +375,33 @@ function install_begin_request(&$install_state) { )) ->addMethodCall('setUserAgent', array('Drupal (+http://drupal.org/)')); + //Register the twig service required by drupal_set_message(). + $container->register('twig.loader.filesystem', 'Twig_Loader_Filesystem') + ->addArgument(DRUPAL_ROOT); + $container->setAlias('twig.loader', 'twig.loader.filesystem'); + + $container->register('twig', 'Drupal\Core\Template\TwigEnvironment') + ->addArgument(new Reference('twig.loader')) + ->addArgument(array( + // This is saved / loaded via drupal_php_storage(). + // All files can be refreshed by clearing caches. + // @todo ensure garbage collection of expired files. + 'cache' => settings()->get('twig_cache', TRUE), + 'base_template_class' => 'Drupal\Core\Template\TwigTemplate', + // @todo Remove in followup issue + // @see http://drupal.org/node/1712444. + 'autoescape' => FALSE, + // @todo Remove in followup issue + // @see http://drupal.org/node/1806538. + 'strict_variables' => FALSE, + 'debug' => settings()->get('twig_debug', FALSE), + 'auto_reload' => settings()->get('twig_auto_reload', NULL), + )) + ->addMethodCall('addExtension', array(new Definition('Drupal\Core\Template\TwigExtension'))) + // @todo Figure out what to do about debugging functions. + // @see http://drupal.org/node/1804998 + ->addMethodCall('addExtension', array(new Definition('Twig_Extension_Debug'))); + Drupal::setContainer($container); }