Last updated November 14, 2013. Created by xaav on February 27, 2011.
Edited by jmcejuela, chemical, drupalshrek, crazybutable. Log in to edit this page.

This tutorial describes how to create a module for Drupal 7. If your goal is to convert a module from Drupal 6 or earlier to Drupal 7, see: Updating your modules.

A module is a collection of functions that link into Drupal, providing additional functionality for your Drupal installation. After reading this tutorial, you will be able to create a basic block module and use it as a template for more advanced modules.

Requirements

This tutorial assumes you have:

  • Basic PHP knowledge, including syntax and the concept of PHP objects
  • Basic understanding of database tables, fields, records and SQL statements
  • A working Drupal 7 installation
  • Drupal administration access
  • Webserver access

This tutorial does not assume you have any knowledge about the inner workings of a Drupal module.

When finished

This tutorial will not necessarily prepare you to write modules for public release. It does not cover important topics such as: caching, permissions, or security issues. Use this tutorial as a starting point and then extend your skills with other resources, including:

When you are finished developing a useful module, you may want to contribute it back to the community. If so follow the instructions for: creating a new full project.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.