December 9, 2009

While attending DrupalCampNYC7 this past weekend at NYU Poly, one of the most eye-popping demos I saw was by Roger López, showing off some functionality hiding in the Chaos Tools Suite to empower you to create awesome AJAX functionality, including modal dialogs/forms, without writing a single line of javascript. You can read Roger's presentation notes here, which I strongly recommend.

Needless to say, I was immediately jazzed by the possibilities of a clean programmatic mechanism for handling data exchanges of this nature. It's complex work, and doing it on a one-off basis is tricky and prone to error. This is why we're all so lucky to be in the same coding community as Merlinofchaos: not only do we get killer apps like Views, we get the infrastructure he writes "for himself" that goes along with it!

I was also sort of surprised/chagrined that I'd been working on Panels all year long and never known about this wondrous gem of an API. But that's a problem I know how to solve: I thought, "hey, this should be a sample module included with ctools by default."

So, on the plane from LaGuardia to New Orleans (where I'm presenting on Friday at Do It With Drupal), I took my own stab at it. This isn't a lot more code than Roger presented, but I cleaned up the namespace and used a few more of the ctools functions.

The sample module shows how to perform simple operations like text replacements, table manipulation, and a modal login form. I'd love to hear other use-cases that would be worthwhile to include in a sample module (chime in on the issue thread). I'm also looking forward to digging in further to add new ctools_ajax/modal commands, so if you've got any great ideas let me know.

It's a great time to be a Chaos Wizard!