prepopulate.module now viable

This is a story of the spirit of Open Source Software, and the community around it.

Once upon a time, I submitted a little patch to Drupal core that allowed Drupal (4.6 at the time) to pre-fill the pieces of the node edit form from the URL. I thought it was a pretty good patch, adding some great functionality with miniscule, clear, code changes. Basically, it removed what had been a hard-coded limitation.

While the patch received some good attention from the likes of Bèr and Boris, others weren’t too keen on the idea. In short, it got “wontfixed,” meaning, the Drupal gods decided that it wasn’t the right direction, and would not commit it to Drupal core.

Of course I was little miffed, and quite disappointed. This was a darn useful patch. I had a bookmarklet I was using, which this patch fixed nicely. So, I put the patch in my Drupal sandbox and committed myself to maintain the patch as Drupal core progressed.

In January, as all of Drupal felt the simultaneous highs and lows of the Form API , Drupal demigod chx laid out the plans for a module that would use the Forms API to prefill the node form, which put to rest all the security fears many of us had about just blindly prefilling the node object. It was a great solution; it just needed to be written.

So I did, well, sort of. I committed a rest.module to my sandbox, that more or less did what was suggested. It had one glaring flaw, though: it did not deal with form arrays.

Still, it did what I needed it to do, what the original patch to node.module did, which was allowed my bookmarklet to work. One great thing about having this as a module was that I did not need to patch core to get it working. Others needed similar functionality, and were pointed to rest.module. Finally someone convinced me to take it out of my sandbox and into the contrib modules repository, and make it a real Drupal contrib project, allowing bug reports, feature requests, and having it appear in the Drupal.org projects area.

So, again, I did. I always hated the name rest.module, as the term “ReST” implies a bit more than what my little module did, so I settled on the name prepopulate.

Very quickly, chx (who has probably forgotten more about PHP than I know) filed the critical bug report that I knew was coming: It didn’t deal with form arrays, which were becoming more and more common.

I worked on it some in the spring, and came up with a fix that kind of, sort of, worked, and prepopulate.module eeked out an existence of sorts.

Fast forward to this month, when prepopulate had another bug filed against it, this one not because it did not deal with form arrays, but rather that it did so, and poorly. My feeble attempt at a fix had resulted in it prepopulating unrelated fields just because they shared a commonly named element. Programming (particularly Drupal development) just hasn’t been high on my list this summer, and this bug was not going to be fixed by me anytime soon.

But here’s where the beauty of open source comes in: the bug was fixed, and elegantly, by someone else. Drupal user egfrith submitted a patch for the old form array bug, and, wouldn’t you know, when it’s done right, everything works.

Now that the critical bug has been fixed, the prepopulate.module is a viable solution for anyone wanting to do any sort of custom content creation entry point for Drupal, whether bookmarklets, custom links in other modules, whatever.

To add to my excitement, chx made sure that everyone on the development list knew that prepopulate is ready by announcing it to the mailing list.

The triumph here is not mine. It’s my module, I commit the fixes, but the fix did not come from me. Looking through egfrith’s patch, I’m certain it would take me some time to come up with a fix that works so nicely. Who benefits here is not me, but all of us. It’s the open source model that allows this to happen, and it’s a community like ours that allows this to flourish.

Tagged as:

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.