Skip to content
Snippets Groups Projects

Issue #3437162: Move twig_debug and other development toggles into raw key/value

Closed Issue #3437162: Move twig_debug and other development toggles into raw key/value
All threads resolved!
All threads resolved!
Files
4
@@ -15,12 +15,10 @@ class DevelopmentSettingsPass implements CompilerPassInterface {
* {@inheritdoc}
*/
public function process(ContainerBuilder $container): void {
// This does access the state key value store directly to avoid edge-cases
// with lazy ghost objects during early bootstrap.
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $state */
$state = $container->get('keyvalue')->get('state');
$twig_debug = $state->get('twig_debug', FALSE);
$twig_cache_disable = $state->get('twig_cache_disable', FALSE);
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $development_settings */
$development_settings = $container->get('keyvalue')->get('development_settings');
$twig_debug = $development_settings->get('twig_debug', FALSE);
$twig_cache_disable = $development_settings->get('twig_cache_disable', FALSE);
if ($twig_debug || $twig_cache_disable) {
$twig_config = $container->getParameter('twig.config');
$twig_config['debug'] = $twig_debug;
@@ -28,7 +26,7 @@ public function process(ContainerBuilder $container): void {
$container->setParameter('twig.config', $twig_config);
}
if ($state->get('disable_rendered_output_cache_bins', FALSE)) {
if ($development_settings->get('disable_rendered_output_cache_bins', FALSE)) {
$cache_bins = ['page', 'dynamic_page_cache', 'render'];
if (!$container->hasDefinition('cache.backend.null')) {
$container->register('cache.backend.null', NullBackendFactory::class);
Loading