Sorry, you need to enable JavaScript to visit this website.

News Drupal UX & Web Design

Theming in Drupal 7 has always been a bit fiddly at the best of times. Unbeknown to me a small feature crept into a Drupal 7 release without me realising - the backport of theme debug settings from the much anticipated Drupal 8. This feature allows you to view debug information directly in the mark-up and not have to go chasing template suggestion names from within the Drupal admin screens.

In your Drupal 7 installation simply add this line to your settings.php:

$conf['theme_debug'] = TRUE;

Clear your caches and refresh the page and you should see debug information in your mark-up which contains template suggestions:

<!-- 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' -->

It may only be a small development in the scale of things, but this really does improve my theming workflow with Drupal 7. All I can say is huge thanks to the Drupal Community for implementing this, as it really does make a difference.

References/Further reading

Tags

theming frontend drupal drupal planet