[DebugBundle] Added 'theme' option to change the color of dump() when rendered inside templates#29528
Conversation
src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php
Outdated
Show resolved
Hide resolved
nicolas-grekas
left a comment
There was a problem hiding this comment.
LGTM with some minor comments.
| ->end() | ||
| ; | ||
|
|
||
| if (class_exists(HtmlDumper::class) && method_exists(HtmlDumper::class, 'setTheme')) { |
There was a problem hiding this comment.
can be simplified:
if (method_exists(HtmlDumper::class, 'setTheme')) {
| ->addMethodCall('setMinDepth', array($config['min_depth'])) | ||
| ->addMethodCall('setMaxString', array($config['max_string_length'])); | ||
|
|
||
| if (class_exists(HtmlDumper::class) && method_exists(HtmlDumper::class, 'setTheme')) { |
There was a problem hiding this comment.
if ('dark' !== $config['theme'] && method_exists(HtmlDumper::class, 'setTheme')) {
There was a problem hiding this comment.
The 'dark' !== $config['theme'] will not launch an undefinex index notice with var dumper 4.1?
In that case, the Configuration class will not initialize the $config['theme'] index because 'setTheme' doesn't exists.
it wouldn't be better to set something like this?:
if (isset($config['theme'] && 'dark' !== $config['theme'] && method_exists(HtmlDumper::class, 'setTheme')) {
Or maybe leave it just as:
if (method_exists(HtmlDumper::class, 'setTheme')) {
as it appears in the Configuration class.
There was a problem hiding this comment.
Correct. if (method_exists(HtmlDumper::class, 'setTheme') && 'dark' !== $config['theme']) { then!
| ->children() | ||
| ->enumNode('theme') | ||
| ->info('Changes the color of the dump() output when rendered directly on the templating. "dark" (default) or "light"') | ||
| ->example('"dark"') |
There was a problem hiding this comment.
The other example calls we have do not wrap strings, should probably be ->example('dark').
feb6f34 to
c0bb3a7
Compare
|
Something went bad when merging, can you re-push your work here? Sorry about that. |
c0bb3a7 to
feb6f34
Compare
|
I've made a git push --force it's that enough? If you need anything else, tell me. |
|
It's not enough. You need to execute |
feb6f34 to
a0db35a
Compare
|
created new origin "sf" (symfony/symfony) I hope i've done well this time |
… rendered inside templates
a0db35a to
91e8057
Compare
|
Thank you @dem3trio. |
… of dump() when rendered inside templates (dem3trio) This PR was squashed before being merged into the 4.3-dev branch (closes #29528). Discussion ---------- [DebugBundle] Added 'theme' option to change the color of dump() when rendered inside templates | Q | A | ------------- | --- | Branch? | master for features | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Added a html_dumper_theme option config to use the new HtmlDumper light theme when using dump() inside templates #SymfonyConHackday2018 Commits ------- 91e8057 [DebugBundle] Added 'theme' option to change the color of dump() when rendered inside templates
Added a html_dumper_theme option config to use the new HtmlDumper light theme when using dump() inside templates
#SymfonyConHackday2018