I spent a day making a module for Drupal. I simply went through the tutorial on the drupal site. This makes a simple block module that displays articles entered into a drupal installation within the last week. Even though the example is simple, going through this tutorial is an excellent way to get an idea about how to make a module for Drupal. I was able to use this tutorial to make a module to get and display messages from Twitter.
Drupal provides an excellent infrastructure for building applications. Developers can focus on making the application or module work and take advantage of all Drupal’s super structure.
Drupal can control who has access to each module. All that is necessary to take advantage of this is to create a module function that describes what permissions a module wants to offer. For example, modules often control access to a module and access to admin for a module.
Download and install the SearchTwit module if you wish.
The form API lets a module present data entry forms. All the module has to do is create an array describing what fields to offer. Drupal generates the HTML form elements and all the controls.
Drupal has a storage area for configuration values. All modules can access this area to read or write information. Therefore, there is no need to write or maintain configuration files.
I intend to expand my module and add some more features. I’m not sure why someone would build a web application from the ground up anymore.
This shows the admin for the module. It has three settings. The search term defines what term the module will search for on Twitter.
The debug setting turns on some debug output. It will write the number of messages it got from Twitter and it outputs the Atom XML to a file. While you can use the module on any site, do not turn on the debug. At least, go into the module and change the location of the file name.
The last setting defines how many messages it will display.
SearchTwit currently outputs its list as an HTML <ul><li> list.
Making this module was very easy. I’m looking forward to doing more.