Closed (fixed)
Project:
Devel
Version:
8.x-1.x-dev
Component:
kint
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Mar 2014 at 18:10 UTC
Updated:
2 Jun 2016 at 10:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
star-szrHere's the patch and screenshots. Feedback welcome.
Example in page.html.twig:

Example in node.html.twig (displays in context!):

Comment #2
star-szrGrammar fix in issue summary.
Comment #3
star-szrRemoved trailing whitespace.
Comment #4
moshe weitzman commentedThis is a big enough piece of code that it is going to need a Maintainer. Would anyone be up for that? It could be the same as the kint module maintainer or someone else.
Comment #5
star-szrI might be up for that once I get the code into a bit better shape.
Comment #6
moshe weitzman commentedCode looks fine. Would be ideal if someone tested this before commit.
Comment #7
moshe weitzman commentedCan be replaced by @\Kint::dump($kint_args);. This did not work with prior version of kint but now that we are on 1.0.0-wip branch it does.
Comment #8
star-szrHm, making that change seems to make it stop working. I pulled the latest 8.x-1.x of devel, rebased my branch and reinstalled D8, everything worked, then I changed all the \Kint to @\Kint and there is no longer any Kint output. Is there something I'm missing?
Comment #9
star-szrHere's the patch and interdiff for testing/comparison.
Comment #10
corbacho commented@Cottser
The @ operator is used by Kint as a "modifier".
http://raveren.github.io/kint
So, there is no need to capture the buffer output, just use the value returned.
Comment #11
star-szrThat makes much more sense, thank you @corbacho!
Here is the change with an interdiff from #3.
Comment #12
moshe weitzman commentedI think you posted the interdiff twice.
Comment #13
star-szrThanks, here's the actual patch.
Comment #15
moshe weitzman commented11: devel-2218949-11.patch queued for re-testing.
Comment #16
moshe weitzman commentedHow can I get this tested again? I am seeing yellow, not green.
Comment #17
star-szrI think the test is postponed because Devel 8.x-1.x-dev HEAD is failing:
https://qa.drupal.org/pifr/test/137984
Comment #18
moshe weitzman commentedCommitted. We should document this somewhere.
Comment #20
amber himes matzThis is great! I think it might make sense to add documentation for this feature on the Debugging variables in Twig templates (https://drupal.org/node/1906780) or else add a page to that section called "Debugging Twig templates using Devel and Kint."
Would that be a good place for this documentation to live? Other suggestions?
Also, FWIW, I am writing up a blog post on debugging Twig in D8 which will be published on the Drupalize.Me blog next Tuesday and I will include a bit about using kint() in a twig template file.
Comment #21
star-szr@agentolivia - thanks! I can't find a handbook section for Devel (at least it's not linked from the project page) so that seems like a good place to start out with the documentation anyway. It can always be moved + linked later.
Comment #22
joelpittetA note for the documentation,
twig_debugmust be turned on in settings.php, or nothing happens. Should be the first sentence IMO. That caught me when trying it out today:)Comment #26
pcambraComment #27
johnalbinDid a google search for drupal and kint and landed here. Followed Amber's link and noticed the Theming handbook still doesn't have docs about kint(). So I added them. https://www.drupal.org/node/1906780#kint
dump() is hard to use. kint() is easier.
Comment #28
willzyx commented@JohnAlbin thanks for the doc update! note that you can also use
{{ devel_dump() }}and{{ devel_message() }}(and their aliases kpr, dpm, dsm) and take advantage of the pluggable dumper system