Creating a Drupal Module

Creating a Drupal module is a remarkably simple thing to do. There are thousands upon thousands of modules out there, but sometimes the need arises to make your own. In this tutorial, I will show you how to make a simple module. This is meant to be a bare-bones lesson to help get you started by creating a simple input filter. Click on Part 1: File and Directory Layout to get started.

  1. File and Directory Layout — how to create the necessary files and folders for your module
  2. The .info File — How to create the module description file
  3. Installation and The _perm() Function — How to add access rules and enable your module
  4. Exposing Functionality and Enforcing Permissions — We will create a simple PHP function which prints out the current date and time. We will then show how it can be called from from a node.
  5. The _filter Function — We will stub out the testmod_filter function and install it.
  6. Implementing a Bracket [] Style Input Filter — Finally, we will use the testmod_filter function to allow bracketed syntax of [testmod datetime] to print out the current date and time.

Please note that the Drupal has their own, more in depth tutorial available here. My tutorial is meant on as a very basic overview, based on one I created for this site which prints out preformatted image blocks.