Commit c05b5bf5 authored by catch's avatar catch

Issue #1843034 by Cottser, japerry, heyrocker, steveoliver, c4rl: Make Twig settings configurable.

parent 05d0b5a8
...@@ -368,7 +368,7 @@ protected function registerTwig(ContainerBuilder $container) { ...@@ -368,7 +368,7 @@ protected function registerTwig(ContainerBuilder $container) {
// This is saved / loaded via drupal_php_storage(). // This is saved / loaded via drupal_php_storage().
// All files can be refreshed by clearing caches. // All files can be refreshed by clearing caches.
// @todo ensure garbage collection of expired files. // @todo ensure garbage collection of expired files.
'cache' => TRUE, 'cache' => settings()->get('twig_cache', TRUE),
'base_template_class' => 'Drupal\Core\Template\TwigTemplate', 'base_template_class' => 'Drupal\Core\Template\TwigTemplate',
// @todo Remove in followup issue // @todo Remove in followup issue
// @see http://drupal.org/node/1712444. // @see http://drupal.org/node/1712444.
...@@ -376,10 +376,8 @@ protected function registerTwig(ContainerBuilder $container) { ...@@ -376,10 +376,8 @@ protected function registerTwig(ContainerBuilder $container) {
// @todo Remove in followup issue // @todo Remove in followup issue
// @see http://drupal.org/node/1806538. // @see http://drupal.org/node/1806538.
'strict_variables' => FALSE, 'strict_variables' => FALSE,
// @todo Maybe make debug mode dependent on "production mode" setting. 'debug' => settings()->get('twig_debug', FALSE),
'debug' => TRUE, 'auto_reload' => settings()->get('twig_auto_reload', NULL),
// @todo Make auto reload mode dependent on "production mode" setting.
'auto_reload' => FALSE,
)) ))
->addMethodCall('addExtension', array(new Definition('Drupal\Core\Template\TwigExtension'))) ->addMethodCall('addExtension', array(new Definition('Drupal\Core\Template\TwigExtension')))
// @todo Figure out what to do about debugging functions. // @todo Figure out what to do about debugging functions.
......
...@@ -283,6 +283,42 @@ ...@@ -283,6 +283,42 @@
*/ */
$settings['update_free_access'] = FALSE; $settings['update_free_access'] = FALSE;
/**
* Twig debugging:
*
* When enabled, you can use the 'dump' function in Twig templates to output
* information about variables, and templates are automatically recompiled
* whenever the source code changes.
*
* @see http://drupal.org/node/1906392
*
* Not recommended in production environments (Default: FALSE).
*/
# $settings['twig_debug'] = TRUE;
/**
* Twig auto-reload:
*
* 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: NULL).
*/
# $settings['twig_auto_reload'] = TRUE;
/**
* Twig cache:
*
* By default, Twig templates will be compiled and stored in the filesystem to
* increase performance. Disabling the Twig cache will recompile the templates
* from source each time they are used. In most cases the twig_auto_reload
* setting above should be enabled rather than disabling the Twig cache.
*
* Not recommended in production environments (Default: TRUE).
*/
# $settings['twig_cache'] = FALSE;
/** /**
* External access proxy settings: * External access proxy settings:
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment