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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

willzyx created an issue. See original summary.

willzyx’s picture

Status: Active » Needs review
FileSize
1.2 KB
willzyx’s picture

Issue summary: View changes
willzyx’s picture

If no one have objections/suggestions I'm going to commit this in the next few days

moshe weitzman’s picture

Looks reasonable to me. Could use some docs though. Not sure how anyone will find it.

willzyx’s picture

Could use some docs though. Not sure how anyone will find it.

Sadly 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

  • willzyx committed b67cd63 on 8.x-1.x
    Issue #2788089 by willzyx: Add xdebug support for Twig template...
willzyx’s picture

Status: Needs review » Fixed

Committed and pushed to 8.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.