When There's Not a Module For That: Building Drupal 7 Modules


Drupal is a powerful and modular system— indeed, much of Drupal's power is in its modules, dynamos of pluggable functionality that can build on Drupal's base system and other modules. This session will show how to add features of your own creation in Drupal 7.

You can write a module yourself. All you need to do is create two files with some text. Once we've dispensed with the myth of module making as the difficult domain of die-hard Drupalistas, we will then go well beyond an easy example, and try to make you a die-hard Drupalista ;-)

We will cover these APIs:

  • form_alter – it's just so much fun
  • menu – this is the power of defining our own pages, among other things
  • database (the new Drupal 7 database layer, DBTNG)
  • node – nodeAPI is de-opped in 7 (it is many focused functions instead of one big switchy/twitchy one)
  • taxonomy – yup, de-opped too
  • user – yet another de-opped API
  • field – yeah this is the big D7 deal
  • entity – the lesser known big deal API making fields possible
  • help – every module should have it
  • theme – because modules have to make themselves themable
  • permissions – using and defining

This session will draw in part on the module development chapters for the Definitive Guide to Drupal 7 and the Xray module developed as an example therein; the methods and tips in this session will be based on the real work of figuring out how to do specific things with Drupal. All the same, the invaluable Examples project will be referred to repeatedly. Our goal is that you learn more than this session teaches you: How to keep learning about module development from Drupal core, from the Examples project, from contributed modules, and from all the other Drupalistas out there.

Intended audience: 

Anyone serious about learning Drupal 7 module development.

If Ezra Barnett Gildesgame (ezra-g) session - http://chicago2011.drupal.org/sessions/introduction-module-development - is also picked and scheduled earlier than this one, we will work with him to reduce overlap and encourage attendees to needing a grounding to attend both.

Questions answered by this session
Question 1: 
How do I write a module that plays well with Drupal core and other modules? (hint: uses lots of hooks)
Question 2: 
How do I make a module is extensible by other modules? (hint: defines its own hooks!)
Question 3: 
How do I make my module easy for users and administrators to use and developers to understand? (hint: contextual links, help, coding standards)
Question 4: 
How do I know when my module is good enough to ship? Where do I get help making it good enough – and secure enough – to contribute to Drupal.org?
Question 5: 
How do I figure out how to do what isn't covered in this session? How do I find answers in other people's code?
Your rating: None Average: 3.7 (28 votes)


I'd love to see a white paper

I'd love to see a white paper of this even if it doesn't get selected!

There'll be a book!

Or rather, a few (lengthy) chapters in Definitive Guide to Drupal 7.

Diamond Sponsors


Platinum sponsors


Gold Sponsors

Drupal Connect
Treehouse Agency
Chapter Three