Drupal Time-savers

If you work freelance like I do, you know that time is money. I’m always trying to shave a few more seconds off my development time. Here are a few tips and tricks that I constantly use:

  • Firefox Wildcard Bookmarks

    Set up some bookmarks with keywords shortcuts and wildcards. I have a bookmark for the forms api reference so that I only have to type ‘forms’ to get to it. I also used this method so that I can quickly look up api functions. I used a similar wildcard bookmark for project pages. Now if I’d like to see the views page I simply type in ‘pr views’. Not only does this save me a lot of time but it also encourages me to go check out modules I might have otherwise put off looking at since it seemed like a slight hassle previously.

  • Drupal CVS shortcut

    I check out a lot of modules from Drupal’s CVS. With Drupal you can just about build a website as fast as you can check out modules. Well, almost. I constantly had to look up the terminal command for cvs checkout until finally I got wise and set up an alias. On my Mac I did this by

    cd (go to your user home directory)
    vi .bash_profile (edit your bash profile in a unix editor I am just not quite geeky enough to have mastered. Alternatively, if you’ve set up Textmate properly you can do ‘mate .bash_profile’)
    Now add the line: alias drcvs=”cvs -d :pserver:anonymous@cvs.drupal.org:/cvs/drupal checkout”

    Now when I want a module I type: drcvs -d {modulename} -r {version} contributions/modules/{modulename} . This I can actually remember.

  • Drupal navigation

    You need to get into admin_menu and/or teleport modules. I’m going to stop giving out links to every great module since by now you should have created your firefox wildcard project bookmark.

  • Parallels (Mac)

    Launching Parallels is faster than Bootcamp or getting up and turning on your old PC. Personally I believe if you’ve so much as touched your client’s css that it is now your moral imperative to recheck everything in both IE6 and 7. Bonus tip: run them both.

  • Firebug

    Firebug is the best thing that ever happened to css as I’m sure you’re aware. Make sure you check which line number of which css file you need to change and then use your text editor’s keyboard shortcut to go straight to that line. I like to use Firebug for anything I might have previously used ‘view source’ for as well. You can make sure that new css or js file you added with drupal_add_css or drupal_add_js loaded properly on your page. Find out your keyboard shortcut to go straight to inspect mode (mine is shift-command-c). I constantly use inspect mode to take a look at the relevant markup. Often if you need to find a theming function a Firebug glance at the markup will give you something to search for in your text editor. It may also give you a hint as to the form_id you’re trying to hook_form_alter.

  • Firefox search

    Go to your Firefox preferences and under General:Accessibility check off ‘search for text when I start typing’. Now you don’t need to hit command-f to search on the page. When you go to admin/build/modules to enable your new module, just start typing the first few letters and you’ll jump down to it on the page. Congratulations: you’ve just saved 200ms. Well, everything adds up.

  • Use your editor

    Mine is Textmate (Mac only) and it’s pretty great. Although you might be tempted to just type a little php in a block edit textarea or similar place, I find that this usually costs me more time than it saves because half the time I mess up a bracket somewhere. If your block is fairly complex you’ll really be glad down the road (probably three minutes from now when you want to edit it) that you took the extra minute to call hook_block in your custom module. If I really do just need to insert a little php, I still write it in my editor and then paste it in. This spares me the otherwise inevitable debugging. I think that doing things right is almost always faster than doing them fast and possibly having to debug them later.

  • Submit a patch

    This might not seem like a time-saving tip but I’ve come to believe it really is. It turns out the only difference between being a frightful Drupal hacker and an esteemed Drupal contributor is whether or not you submitted a patch. I used to always hear “don’t hack Drupal” and wonder how the hell these people thought that was possible when surely we all know there are dark corners of code where the override and hook systems never reach. Finally I realized they probably just submit a patch and call it ‘contributing’ instead of ‘hacking’. Actually I didn’t realize this until some point after I joined them.

    When you get in the habit of submitting a patch immediately after debugging or adding a new feature to a module, it will only take you a few minutes to do. The time savings comes from the fact that you now have other eyes on your work. Sometimes the module maintainer will turn around and point out to me a bug in my patch that I hadn’t yet tested for. Usually they will eventually commit my patch, which may be a time-savings for me on some future project or when upgrading the current one. Or they might give me a tip like “upgrade to my latest version you idiot because it’s actually way better” which is valuable to know. Maybe they will like my code so much that they will offer me marriage or employment, which could be side benefits on my time-saving mission.


Mark (not verified) on February 6, 2008 - 1:07am

Hey thanks for the great tips - I like the Firefox “search for text as you type” and wildcard bookmarks ones especially!

Boris Mann (not verified) on February 6, 2008 - 2:27am

Submit a patch! That tip alone is worth its weight in gold. “It turns out the only difference between being a frightful Drupal hacker and an esteemed Drupal contributor is whether or not you submitted a patch.” — so far that wins for quote of the year!

Web Design by Kineta Systems (not verified) on February 6, 2008 - 5:35am

Hey thanks for the article…

Had a good chuckle about the “hacking” bit :)

As an extra in Firefox, you can start searching by hitting forward-slash only, which is a nice intermediate between CTRL-F and “search as you type”, the latter of which I personally despise… :p This is called “quick search”, and doesn’t come with the full set of search controls, but if you’re just looking for a keyword on the page, you’re golden.

Hope that helps.

— Nik

greggles (not verified) on February 6, 2008 - 6:17am

Great tips! I’m a big fan of firefox wildcard bookmarks + keywords but I hadn’t thought of the “pr views” system. That will save me at least a few minutes each day.

Barry (not verified) on February 6, 2008 - 7:53am

I used to think Firebug was the greatest thing to happen to css, and then I found CSSEdit (Mac only). It is quite simply the single most effective time saver in my arsenal of tools!!

To be clear - I am in no way affiliated with CSSEdit or it’s writers. I just use it and love it!

Ezra (not verified) on February 6, 2008 - 10:05am

Another way of running Internet Explorer on OSX without running Windows is http://www.kronenberg.org/ies4osx/ .

Thanks for this article!

jody on February 6, 2008 - 10:10am

Somehow that ies4osx didn’t work for me when I installed it. I should try again, thanks.

Shai (not verified) on February 6, 2008 - 5:42pm

Way to go Jody. Great ideas. I’m bookmarkin’ this page!

Kevin (not verified) on February 6, 2008 - 5:56pm

Fantastic tips Jody!

You’ve finally convinced me to take the time to set up some Firefox shortcuts.

If they could only help me find my CTR ring ;)


Scripthead (not verified) on February 7, 2008 - 9:12am

Firebug is also very useful for jQuery development. You can quickly locate Xpath on any object that can be later used with jQuery. Do do this open Firebug, click Inspect, select your object, right click on the very tag in the Firebug menu and select Copy Xpath.

canaryMason (not verified) on February 7, 2008 - 5:16pm

Great tips, Jody! I definitely wasn’t using FF keywords effectively before. I’m also rearin’ to submit some patches, if only I could config cvs on this Vista box. Blurg.

theBorg (not verified) on February 19, 2008 - 1:59pm

Excellent tips!!

I use vmware fusion to test IE, run great on mac also.


Mike Macgirvin (not verified) on April 24, 2008 - 4:59pm

In addition to Firebug, the ‘Clear Cache Button’ toolbar add-on has saved me countless hours of poring over code and wondering why my changes didn’t work. Answer: They did, but the cache bit me.

Also, if you’ve got a bug that’s IE only and are forced to use the wretched thing, it’s useful to have the Internet Explorer Developer Toolbar - which isn’t Firebug, but it’s not bad. There’s also a commercial product (free for personal use) called DebugBar which looks to be a Firebug clone for IE and provides full JS debugging ability.

pagerank (not verified) on May 3, 2008 - 9:52pm

Great tips, thanks a bunch for sharing!

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see and Markdown Extra for tables, footnotes, and more.

More information about formatting options