Community Documentation

Creating modules - a tutorial: Drupal 7.x

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:

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.

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 7.x
Audience
Programmers

Develop for Drupal

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.