GVS is now part of Acquia. Acquia logo

Drupal 6 Api Cheat Sheet

Greg's picture

As Drupal developers and themers, we spend a lot of our time referring to the Drupal API Reference which provides great information about functions to use and how to write code for Drupal. It can be a little daunting to look at that site if you are a new user: what are you searching for? what areas should you explore? For more seasoned developers there are times when api.drupal.org is not as useful: what if you are offline or just want a quick overview of the functions you use most often?

So, we built up this cheat sheet to provide a guide of important functions new users might not know and also to give a quick reference sheet for more advanced developers.

Download the Drupal API Cheat Sheet

You can download the cheat sheet in pdf format which is linked to api.drupal.org in case you need more information on a specific function.

After gathering suggested functions we had some room on the card and debated: more functions that are less valuable or some related topics. We decided to go for some related topics and added just a smidgen of Linux Command Line fun with useful commands and cvs tips. We also included the tiniest form example to get folks started down the road to awesome forms using the FormAPI.

Deciding on Functions to Include in the Cheat Sheet

It was actually a surprisingly fun process deciding on which functions to include in the cheat sheet (and coming up with the descriptions for them, really). The basic process was to first do an internal brainstorming session with our team.

Then, like most things in our community, we turned to #drupal-colorado to get feedback. Brad beeradb Bowman, John Fiala, Ben coltrane Jeavons and Matt ultimateboy Tucker all helped out brainstorming. One fun technique we used was to start typing api.drupal.org into the Firefox 3 url bar and let the awesome bar do it's magic suggesting functions we often refer to (you are encouraged to do this too and leave your suggested functions in the comments).

AttachmentSize
drupal6_api_cheatsheet_final.pdf241.6 KB

Comments

It would be wise to add

It would be wise to add format_plural() to Textual section.

In 2 years of Drupal

In 2 years of Drupal development, including a relatively diverse number of modules written, I never (!) had to touch hook_comment() even once. Can't be that important.

Also, user_load() in Drupal 6 (finally) does not need array('uid' => $uid) but works with a single $uid argument as well.

db_result() might be better described as "...as the value of this record's (only) field." (needs to go after db_fetch_object()).

theme_item_list($items) of course needs to be theme('item_list', $items).

drupal_json() could be described with something like "For AJAX/AHAH callbacks: Render an array (object?) to JSON, set the HTTP mimetype header, and exit().".

Maybe there's some place for dpm() in "Random functions" still, it's the most important debug function ever (and probably used more than most other functions on the cheat sheet).

Thanks for the feedback,

Thanks for the feedback, Jakob. We've incorporated some of it in an updated version.

Different people use different hooks different amounts. In my 4 years of Drupal development I've used hook_comment quite often.

We struggled on what was the most appropriate set of functions to include - ultimately there is a limited amount of space on a single page.

Thanks again for the advice.

Listed on

The suggestion about Install

The suggestion about Install Module snippet. I use the command which allows multiple modules installation:

wget http://ftp.drupal.org/files/projects/module1.tar.gz
wget http://ftp.drupal.org/files/projects/module2.tar.gz
...
wget http://ftp.drupal.org/files/projects/moduleN.tar.gz
for i in *tar.gz; do tar -zxvf $i; rm $i; done

I love Drupal. Nice tutorial

I love Drupal. Nice tutorial you have here. Very useful for all Drupal developers. Thanks.

GVS projects

CertifiedToRock.com was created to allow community members and employers to get a sense of someone's involvement with the Drupal project.

GVS is now part of Acquia.

Acquia logo

Contact Acquia if you are interested in a Drupal Support or help with any products GVS offered such as the Conference Organizing Distribution (COD).

We Wrote the Book On Drupal Security:

Cracking Drupal Book Cover