My Love Affair With Drupal's Open Source Platform

So we have all sorts of things going at any one time around here.  Personally I have a ton to do, so I often find myself working from home during evenings and weekends.  My personal project lately has been a service that we're hoping to roll out later this  year, but I'm using Drupal 6 (the newest version) and as such, there's a bit more learning curve on it.  However, with that learning curve comes new abilities, and new power that we previously did not have.  This project is a great example of some of those new abilities in action, and I'm hoping to put up some tutorial work later on this same topic.

The Problem

The problem stems from the fact that the new Drupal 6 Form API has what's known as "AHAH" built into the system by default.  AHAH stands for "Asynchronous HTML and HTTP" which is quite similar to AJAX for those of you who are familiar.  I'm not going to get into a technical discussion concerning these two technologies currently except to say they're both valid ways of injecting content onto your screen after it's loaded without refreshing the page.  Now, I said that the problem stems from FAPI 3 having AHAH available in it, and that's not entirely accurate.  The problem isn't FAPI itself, rather the problem is that it's hard to use.  The Drupal community, by-and-large, generally creates great APIs that only take a little learning and then they're pretty easy to use.  This particular feature of the new API was not anywhere close to "easy" to use, and the intuitive way of working with it simply wasn't available.

The Desired Solution

If the world were exactly what I would like it to be, which it's not, then using these new ahah features inside of FAPI 3 would be as simple as pointing the related path at a menu hook that just returned more FAPI code... it's no where close to that simple, so we begin learning by opening up the core poll module and hacking away at what it does hoping that some light bulb will go off.  After about 2 weeks of beating my head against that wall I finally found some relief today.

The great thing about an Open Source community is that these sort of serious support issues are often solved by an ingenious mind that likes the proposed difficulty of solving the present problem.  A number of individuals chose to offer me serious help during the course of my problem solving sessions, the final one of which was a fantastic developer, Wim Leers.  Wim has helped me out on a number of things, and has become a pretty good friend.  He took a look at the code I was working with and did the research necessary to get up to speed on the new changes in Drupal 6, and helped me out by building a set of helper functions and sub-functions to get the job done.

The Solution

So, Wim agreed with my assessment of the situation, this should be as easy as just creating the form elements you'd like to pass around and letting Drupal do the heavy lifting.  Unfortunately that's not immediately possible or at least, not obviously so, however, equipped with his formidable command of Drupal and PHP in general Wim created a solution that comes amazingly close to making it as simple as the desired solution.  Again, I'm not going to get into the technicalities of it at this point except to say that I'd like to delve into it in more depth in a later article.  The point of this article is to show how great open source communities really are, and that they are a truly amazing resource.