diff --git a/src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php index 436a95c50b..5f98efab0d 100644 --- a/src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php @@ -13,6 +13,7 @@ namespace Symfony\Bundle\DebugBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; /** * DebugExtension configuration structure. @@ -28,8 +29,8 @@ class Configuration implements ConfigurationInterface { $treeBuilder = new TreeBuilder('debug'); - $treeBuilder->getRootNode() - ->children() + $rootNode = $treeBuilder->getRootNode(); + $rootNode->children() ->integerNode('max_items') ->info('Max number of displayed items past the first level, -1 means no limit') ->min(-1) @@ -53,6 +54,19 @@ class Configuration implements ConfigurationInterface ->end() ; + if (method_exists(HtmlDumper::class, 'setTheme')) { + $rootNode + ->children() + ->enumNode('theme') + ->info('Changes the color of the dump() output when rendered directly on the templating. "dark" (default) or "light"') + ->example('dark') + ->values(array('dark', 'light')) + ->defaultValue('dark') + ->end() + ->end() + ; + } + return $treeBuilder; } } diff --git a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php index 317f2fba4e..968fa81f75 100644 --- a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php +++ b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php @@ -18,6 +18,7 @@ use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\VarDumper\Dumper\CliDumper; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; /** * DebugExtension. @@ -42,6 +43,11 @@ class DebugExtension extends Extension ->addMethodCall('setMinDepth', array($config['min_depth'])) ->addMethodCall('setMaxString', array($config['max_string_length'])); + if (method_exists(HtmlDumper::class, 'setTheme') && 'dark' !== $config['theme']) { + $container->getDefinition('var_dumper.html_dumper') + ->addMethodCall('setTheme', array($config['theme'])); + } + if (null === $config['dump_destination']) { $container->getDefinition('var_dumper.command.server_dump') ->setClass(ServerDumpPlaceholderCommand::class)