Recipe 69: Displaying Themeable function names in Source Code
Recipe 68 provided a reference to all of the site's themeable functions. Yet even with a comprehensive list of available functions, it can sometimes be a little tricky to determine exactly where in the site the functions are used. This recipe will make these functions easier to track down. This temporary change to core Drupal code should only be used on a development site, not on a live site.
Make a backup of
theme.inc
located in the Drupalincludes
directory.Edit the theme function found on line 162 of
theme.inc
. Replace this line:$output = call_user_func_array($functions[$function], $args);
with the following two lines:
$output = call_user_func_array($functions[$function], $args); return "<!-- BEGIN theme_$function -->\n$output\n<!--END theme_$function -->\n";
View the source code of a page a browser (in Firefox or Chrome, press Ctrl+U, or right-click the page, and choose View Page Source). Then do a find (Ctrl+F in...