What to do when devel and devel themer aren't printing any messages in Google Chrome
Technical article (Planet Drupal)
I recently had a problem with both devel and devel themer: neither were printing any messages to the page. When I called dpm()
my debugging messages didn't show up, and when I enabled the devel themer module the "Themer info" popup wasn't appearing on any page. This small but incredibly annoying problem drove me crazy, and I couldn't immediately find a solution mentioned in the issue queues or elsewhere online. But I eventually figured out it, and here's how to fix it!
I eventually determined that the problem was with syntax errors on my site, which I noticed while printing other debugging information to the console. I had two problems: a fatal error in a custom javascript file, and an empty site logo definition in my theme which resulted in Drupal printing the logo as <img src="http://mysite.com/">
. This broken <img>
tag caused an error in Chrome, as the server was returning a resource of type text/html and not an image, and the Javascript problem was caused by calling the JQuery Dialog method $('#popupDialog').dialog()
on a page without <br><div id="popupDialog"> present. In both cases Chrome stopped trying to process elements of the page, breaking the display of debugging information.<p>Once I changed the theme setting to not print a logo, and wrapped the dialog setup function in <code>if ($('#popupDialog').length){}
, the console errors disappeared and the Javascript scripts which power devel and devel themer were able to run without any problems. Of course, if you have this problem you've probably made a different syntax error, but the take away message here is to check the console when Javascript on your page isn't running.
And with that, I'm going to go open documentation requests in the issue queue for both these modules now. Happy debugging!
Edit: a reader points out that kpr()
will work better in the theme layer and possibly avoid this sort of problem. I would still advise dealing with any critial errors shown in the browser console, though.