ThingyMaJig

Thingy Ma Jig is the blog of Nicholas Thompson and contains any useful tips, sites and general blog-stuff which are considered interesting or handy!

Connect

LinkedIn GitHub

Topics

announcement 25 apache 3 Apple 1 bash 8 code 7 cool 30 Days Out 8 Dark Basic Pro 4 design 12 doctor who 1 Drupal 74 E4600 1 EOS 400D 3 firefox 2 Flickr 3 free 21 games 5 geek 38 git 2 GreaseMonkey 1 hardware 7 Homebrew 1 How to 37 humour 5 iphone 1 javascript 1 jquery 1 K800i 6 k850i 4 lighttpd 3 linux 33 mac 9 miscellaneous 4 mobile phone 9 music 4 mysql 8 n73 1 n95 1 New Relic 1 Ogre3D 1 OS X 2 performance 3 photos 10 programming 40 Quicksilver 1 review 19 security 3 SEO 6 software 12 svn 2 technology 4 tip 7 tips 10 tv 3 video 3 vim 7 webdev 2 websites 33 wii 1 windows 1 YADS 10

Hidden Drupal development functions

Posted on 02 October 2007 in
programming Drupal

I was browsing around the Devel Module the other day and I noticed a few functions that are not mentioned in any documentation that I've seen but make life even easier, as if Devel doesn't make it easy enough! Almost everyone that's used Devel will be familiar with dprint_r (A debug version of the popular print_r function in PHP). Well who has used these ones?

[adsense:468x60:4496506397]

The dpr simply "saves carpal tunnel syndrome" (as the comment for the function in devel.module says) and the dvr function is funky useful as it not only dumps the data but also the data TYPE too (eg, is this variable a integer zero or boolean false?). The dpm and dvm functions are useful as the message only gets printed out on a visible page. This makes form output debuging easier.

Who here has debug outputted the $form_values on a form_submit and spent a few minutes wondering why nothing came up (due to the redirect after submit) and then ended up adding exit calls to the code to see the output or enabling the form redirection interruption from the Devel Module? Well if you use dpm or dvm then you will get the form output in a message on the next visible page without any workflow interruption! Cool, eh!

These are REALLY useful commands! Thanks to Moshe for adding the var_dump variants and I can only assume it was Moshe's idea to have the shortcut dpr and dpm functions to start with!