diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php index 00d49e2..b4b4290 100644 --- a/core/lib/Drupal/Core/CoreBundle.php +++ b/core/lib/Drupal/Core/CoreBundle.php @@ -367,7 +367,7 @@ protected function registerTwig(ContainerBuilder $container) { // @see http://drupal.org/node/1806538. 'strict_variables' => FALSE, 'debug' => settings()->get('twig_debug', FALSE), - 'auto_reload' => settings()->get('twig_auto_reload', 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. diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php index a41542b..003d61e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php @@ -58,6 +58,12 @@ function testTwigDebugOverride() { // Check isDebug() via the Twig service container. $this->assertTrue(drupal_container()->get('twig')->isDebug(), 'Twig debug enabled.'); + $this->assertTrue(drupal_container()->get('twig')->isAutoReload(), 'Twig automatic reloading is enabled when debug is enabled.'); + + // Override auto reload when debug is enabled. + $this->settingsSet('twig_auto_reload', FALSE); + $this->rebuildContainer(); + $this->assertFalse(drupal_container()->get('twig')->isAutoReload(), 'Twig automatic reloading can be disabled when debug is enabled.'); // Disable debug and check the service container again. $this->settingsSet('twig_debug', FALSE); diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 095852a..660e9e7 100755 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -286,7 +286,8 @@ /** * Twig debugging: * - * Displays debugging information in comments surrounding Twig template output. + * Display debugging information in comments surrounding Twig template output + * and automatically recompile templates whenever the source code changes. * * Not recommended in production environments (Default: FALSE). */ @@ -295,9 +296,11 @@ /** * Twig auto-reload: * - * Automatically reload Twig templates whenever the source code changes. + * Automatically recompile Twig templates whenever the source code changes. If + * you don't provide a value for twig_auto_reload, it will be determined based + * on the value of twig_debug. * - * Not recommended in production environments (Default: FALSE). + * Not recommended in production environments (Default: NULL). */ # $settings['twig_auto_reload'] = TRUE;