Last updated May 31, 2012. Created by xaav on February 27, 2011.
Edited by chemical, drupalshrek, crazybutable, jn2. 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.
This tutorial will not necessarily prepare you to write modules for public release. It does not cover caching, nor does it elaborate on permissions or security issues. Use this tutorial as a starting point, and extend your skills with other resources, including:
- Examples for Developers, modules written specifically to illustrate various aspects of Drupal development with verbose comments
- Other modules, including contrib and core
- Drupal documentation
- Writing secure code
- Coding standards
- Creating a new full project
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 you are finished developing your module, you may want to contribute it back to the community, so then follow the instructions for creating a new full project.