Module plug-ins

I implemented a custom module for my employer to do real-time search transactions against a remote web service. Then I started to think about creating another one for a similar transaction against a different remote service. And I knew there would be more to come.

The module is pretty basic on the Drupal side. Present a form, do the lookup on submit, output the results if any followed by another form. All of that boilerplate would be the same between such modules above. Only the form and the output might vary a bit, and the ultimate backend data source would be different.

It only took me a few moments to hit on the idea of writing the Drupal module and boilerplate code once, and "including" only the transaction-specific form and submit handling routines as needed. Then I could just plug-in more transactions and data sources as a I went. I thought about it a bit more and realized I would probably want separate permissions for each transaction and/or data source. But that could be plugged in also.

So I started building my plug-in capable module. Before re-inventing the wheel on dynamically including my plug-in *.inc files, and calling their functions (hooks!), I asked on IRC if anyone knew of anything similar.

Very quickly I learned about Morbus Iff's game module which already implements a superset of what I need. I'll be borrowing liberally from his code!