IM2 | OQP

2008/05/21

Drupal Actions vs new core features

Filed under: English, anglais, development, drupal, free, free software, koumbit, open source, software, web Robin @ 13:14 (1975 lectures)

For a Drupal 5 project Koumbit is currently working on, we needed token support in the Actions module to send emails. Unfortunately, that feature wasn’t available for the version we’re using. I was happy to help and developped a new tiny module, and this explains why.

The Actions module has been in development since Drupal 4.7 and made its way into the Drupal 6 core. It’s the dedicated work of John VanDyk, co-author of the Pro Drupal Development book with Matt Westgate (of Lullabot fame). Anarcat, one of the Koumbit founders, also contributed to the actions module. PDD is a great book if you’re a programmer looking for an excellent overview of the Drupal mecanics, but I’d wait until this summer to get the second edition which will cover Drupal 6 (current edition is for Drupal 5), including Actions and Triggers.

The module is available in two flavours for Drupal 5:

“The actions 5.x-1.2 module with the old-style actions is deprecated. It is available for download below but all further development will take place in the 5.x-2.x branch (which corresponds to the code in core in Drupal 6 and higher).” — John VanDyk on the Actions module page

We know that Drupal 6 only gets bug fixes since new features going into Drupal 7 (which probably won’t be release for another 9 months). I’m afraid to interpret that quote to actually mean the Actions modules, as it’s available in Drupal 5 as a backport of the Drupal 6 core version, won’t see any new features :(

In Drupal 5, I’ve seen a few patches to make use of the Token module in the Actions Module, but they were all written for 5.x-1.2 when we’re using 5.x-2.5 (the current Drupal 6 backported from core). Instead of patching the module, I decided it was simpler (and cheaper too) to write another module, extracting the current email action code, and rewriting only that to use tokens instead of actions’ own variables. The proper thing to do is probably to go through all the actions and rewrite them all for tokens. There’s the display message action, what else..?

The code is going online in a few minutes. It can also serve as an exemple to build other actions in Drupal 5, using the new style. I will contact John, the current module maintainer, and ask his opinion. If he wants, I’ll roll a proper patch using my module, and deprecate it on my end. No biggie. Release early, release often, I hear ya.

The Actions token email module for Drupal 5, Actions 2 compatible, is now ready for mass consumption.

One final though. Since Actions version 2 is so different then version 1, perhaps it would have been better to release the new version as another module, not just another branch. That would make it much easier today to distinguish between the two different APIs and dependent modules. Is it too late? I’ll ask John that, too, while I’m at it.

2 Comments »

  1. The 5.x-2.x version of actions is indeed getting development love. See here.

    As for naming it differently, I think not. Drupal’s module naming conventions already distinguish them. A 5.x-1.x release is different from a 5.x-2.x release. See here. That’s why the views module is not renamed to views 2.

    Note that dependent modules can support both old and new style actions without conflict (though I strongly recommend going to Drupal-6-style actions, as I plan no more development for old-style actions).

    Comment by John — 2008/05/21 @ 14:52

  2. Thanks for responding so quickly, John. I had the feeling Actions was somehow different since it got incorporated into core (or backported, should I say).

    Should I roll out a patch (or many) to integrate token in actions? It doesn’t have to be a dependency on token either, just make optional use of it.

    Comment by Robin — 2008/05/21 @ 16:23

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress