Blog

Add AJAX to a Webform in Drupal 7

The Webform module is wonderful. It provides us a quick and easy way to add forms to our site, and takes care of the form handling. And, it’s all done through an easy to use GUI. With the release of Drupal 7, the Form API got tweaked a bit. More specifically, the AJAX handling of forms is now quite a bit more straight ahead. I recently had a site build where I needed a contact form to be submitted using AJAX. A confirmation message would replace the form after a successful submission. Unfortunately, there’s no release of the Webform Ajax module for Drupal 7, so I had 2 choices: 1) Use the Form API, write my own form validations and submit handling to store submissions in the database and send emails out, or 2) use the Webform module and alter it to use AJAX. From the title of this blog, you know that the latter was the winner. Let’s get started.

(more…)

Managing Drupal sites with AEgir: Getting Started

AEgir has been a hot topic among Drupalers these days. In case you’re not familiar with what AEgir is, it’s basically a Drush GUI that allows users to manage multiple Drupal instances under one unified interface. While this doesn’t sound like much on the surface, the ability to upgrade multiple Drupal sites, migrate and clone sites, manage backups, and create new Drupal sites all at the click of a button is pretty powerful stuff. (more…)

Using the Pathauto API Drupal Module: A Simple Example

Pathauto is a wonderful tool. It’s definitely my oldest friend when it comes to Drupal modules. As the module has progressed, the API has become easier to use. This means we can make clean and beautiful URLs for our custom Drupal implementations, painlessly. For this example we are going to create a menu callback to display extra information about the blog content type. We will then use the Pathauto API to create the customizable url aliases.

(more…)

Taking Advantage of Git Submodules with Drupal

While building Drupal websites, we end up building modules for all sorts of random tasks – anything from simply reorganizing the contents of a node object or adding fields to the Site Information page to views plugins or huge integrations. It’s not unusual to have both in-house and contributed modules for which you or your company are the maintainer, that you use across many project. The problem is this: if you have twenty projects running your in house module and it requires a security update, you’re stuck manually updating each project by patching the files and then following your normal workflow. Your contrib modules can take advantage of Drush for updates, but Drush won’t solve the problem of ongoing project based module maintenance. (more…)

The Scary World of Data Migration… From HTML Pages to Drupal 7, Part 2

So we’ve successfully used QueryPath to extract our data from the flat html files. Now, it’s time to put that data into our Drupal 7 site.

There were some great Drupal 6 modules to handle data imports like Feeds and Node Import. Unfortunately neither of these are fully baked for Drupal 7. Fear not, though, there is a way. As in Drupal 6, you can easily load the Drupal runtime in custom scripts. This gives you access to the full Drupal 7 API, and in the case of data migration, easily allows you to programmatically create nodes. I’ve already set up my content type, and named it “review”. I’ve also set up a folder called “qp” in the Drupal root directory where my custom php file will live. Let’s get started: (more…)