diff --git a/core/lib/Drupal/Core/Theme/ComponentPluginManager.php b/core/lib/Drupal/Core/Theme/ComponentPluginManager.php index a0c93317699fc8066a239e47949277c6b6f1101b..d76d99119fa452598f1610890317898eee816ba3 100644 --- a/core/lib/Drupal/Core/Theme/ComponentPluginManager.php +++ b/core/lib/Drupal/Core/Theme/ComponentPluginManager.php @@ -124,6 +124,20 @@ public function createInstance($plugin_id, array $configuration = []): Component } } + /** + * {@inheritdoc} + */ + public function getDefinitions(): array { + $development_settings = $this->keyValueFactory->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) { + $this->definitions = $this->findDefinitions(); + return $this->definitions; + } + return parent::getDefinitions(); + } + /** * Gets a component for rendering. *