Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

Note: If you use PHPStorm, it provides a similar functionality (blog, docs), as does the Devel module.

This module enables you to use Xdebug breakpoints with Twig templates.

INSTALLATION

On Drupal 8.3.x or higher, use Composer to install the module and its dependencies (with the --dev flag so you can omit it on production builds):

composer require --dev drupal/twig_xdebug

Installation methods for earlier versions are covered in the README.

USAGE

(If you haven't used Xdebug before, you'll want to set it up first.)

Place {{ breakpoint() }} into your Twig template. The breakpoint won't open in your Twig file. It opens in a file outside your Twig template - BreakpointExtension.php. Here, you still can inspect all of the variables as if you were running Xdebug within the Twig template. The key values you'll see are:

$context: Variables available to use in the template.

$environment: Information about the Twig environment, including available functions.

$arguments: If you supply an argument to breakpoint (e.g. {{ breakpoint(fields) }}), it'll be viewable here.

GUIDES

Highly recommended:

zakiya's Debug Drupal 8 Twig Templates with the Twig_Xdebug Module

amyvs' Demystifying Rendered Content in Drupal 8 Twig Files

justinlevi's Drupal 8: twig_xdebug module tutorial

HOW IT WORKS

When the Twig compiler hits {{ breakpoint() }} in your Twig template, it makes a call to a Twig extension where xdebug_break() is implemented, which triggers Xdebug.

REQUIREMENTS

This module uses the Composer package ajgl/breakpoint-twig-extension.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Core Release date
8.x-1.4 Stable Dec 2, 2024