0

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?

2

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') -->
<!-- FILE NAME SUGGESTIONS:
   * 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' -->
  • thanks kiamlaluno..................... buddy exectly as per my expectation – Manoj Paul May 13 '17 at 11:22
0

Add this line to your settings.php:

$conf['theme_debug'] = TRUE;

You can enable it with drush using:

drush vset theme_debug 1

And disable using

drush vset theme_debug 0

Source

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.