David Rothstein pointed out in the comments that as of Drupal 7.33, this functionality has been back-ported to Drupal 7.

enter image description here

Is there any template debugging technique similar to Twig debugging?


As reported in Working with template suggestions, yes.

As of Drupal 7.33, Drupal core has a theme debug mode that can be enabled and disabled via the theme_debug variable. Theme debug mode can be used to see possible template suggestions and the locations of template files right in your HTML markup (as HTML comments). To enable it, add this line to your settings.php:

$conf['theme_debug'] = TRUE;

As said in that page, you can use Drush to enable/disable it, respectively with drush vset theme_debug 1 and drush vset theme_debug 0.

After you set theme_debug to TRUE, the source of the page will appear as follows.

<!-- THEME DEBUG -->
<!-- CALL: theme('page') -->
   * page--front.tpl.php
   * page--node.tpl.php
   x page.tpl.php
<!-- BEGIN OUTPUT from 'modules/system/page.tpl.php' -->

<!-- END OUTPUT from 'modules/system/page.tpl.php' -->
| improve this answer | |
  • thanks kiamlaluno..................... buddy exectly as per my expectation – Manoj Paul May 13 '17 at 11:22

To enable debug mode

option #1. settings.php

add the following line:

$conf['theme_debug'] = TRUE;

option #2. drush


drush vset theme_debug 1


drush vset theme_debug 0


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.