Developing modules for Drupal 7
In this section of the tutorial, I will demonstrate that Drupal is not just a CMS. We will explore what Drupal modules consist of, and we’ll also create a few of our own modules.
Drupal is a rapidly evolving system. As of today, version 7 of Drupal has been released. Thousands of modules are being developed to add various features to websites. However, sometimes we need to configure modules beyond what can be done via the interface. There are times when we’re unhappy with the order in which data is displayed or with how it looks. That’s when the Drupal framework becomes very helpful. We will be learning about the capabilities of this framework on the following site:
We’ve decided to create a module in Drupal. What do we need for that?
- A general understanding of the Drupal structure. At a minimum, know that additional modules are usually placed in the sites/all/modules directory. If such a folder does not exist, create it.
- Knowledge of the basic structures of the PHP language, which Drupal itself is built with. If you’re not yet familiar with PHP, don’t worry — I’ve prepared a set of documentation pages to help you get started:
- PHP operators
- PHP variables
- PHP expressions
- PHP arrays
- PHP control structures
- The for loop
- PHP functions
Now let’s start by understanding what a module is made of, and we’ll make a small change to our site using hooks. What is a hook? We’ll cover that in the next article.