It might be very useful add support for debugging twig templates with xdebug.
The idea is stolen from here (AjglBreakpointTwigExtension). The implementation in devel is quite simple and consists in few lines of code. Debugging twig template with xdebug is simple as put
{{ devel_breakpoint() }}
in the template of interest. When the template is evaluated is made a call to devel's twig debug extension in which you use xdebug_break(), that emits a breakpoint to the debug client. In this way you'll be able to inspect any variables available in the template (enviroment, context, specific variables etc..) in your IDE using xdebug.
Edit:
I noticed that a module for this already exists for drupal 8 (twig_xdebug) but it could still be useful to include this functionality in the devel module.
Comment | File | Size | Author |
---|---|---|---|
#6 | add_xdebug_support_for-2788089-6.patch | 4.16 KB | willzyx |
| |||
#2 | add_twig_xdebug_support.patch | 1.2 KB | willzyx |
|
Comments
Comment #2
willzyx CreditAttribution: willzyx commentedComment #3
willzyx CreditAttribution: willzyx commentedComment #4
willzyx CreditAttribution: willzyx commentedIf no one have objections/suggestions I'm going to commit this in the next few days
Comment #5
moshe weitzman CreditAttribution: moshe weitzman at Acquia commentedLooks reasonable to me. Could use some docs though. Not sure how anyone will find it.
Comment #6
willzyx CreditAttribution: willzyx commentedSadly this is true for a lot of the devel's functionalities :(
I Think we should dedicate some love/time to the documentation.. probably create a documentation page in which show and explain all the module's functionalities is a good idea
Added dockblock and a basic test coverage
Comment #8
willzyx CreditAttribution: willzyx commentedCommitted and pushed to 8.x