Drupal Theme Function and Template Discovery

This article was published in the print magazine Drupal Watchdog, Volume 2 Issue 1, , on page 8, by Tag1 Publishing. The magazine was distributed at DrupalCon Denver, . The article was also published on their website.

If you have multiple layers of overridable theme functions and templates, it can become difficult to determine which ones are determining the formatting of any given element on the page. Fortunately, you can use the Theme developer module, which places on every page a "Themer info" dialog, with a checkbox.

Themer info dialog
Figure 1. Themer info dialog

After activating it, when you hover over any element, a red border appears. If you click the element, you are shown the functions and templates that created it, and the names you could select from to override that functionality, as well as the function arguments.

Article field themer info
Figure 2. Article field themer info
Copyright © 2012 Michael J. Ross. All rights reserved.
bad bots block