My first Drupal.org documentation

Drupal has a built-in form abstraction system called Form API (or FAPI), which like the Atom protocol consists of two complementary halves. The first is an abstraction of forms to structured data, and is dealt with very well by both online documentation and the excellent Pro Drupal Development. The second is a workflow for turning this data into forms, validating form submissions, and processing valid submissions onto output streams such as the database, the browser or emails to the user.

This second half is quite complex and, like much of Drupal, has various points at which the user can hook into the process: whether by use of the hook_* functions that modules use to talk to each other and the core, or by defining #callback array elements within the FAPI structured data. However, documentation is pretty sparse: PDD is rather quiet on complex workflows, although it does have a lot of slightly higher-level, prose information.

Someone had already taken steps to rectify this: drupal.org user KarenS sent round a detailed flowchart of FAPI’s functional internals which detailed the function-by-function process of FAPI. Seeing a definite niche for a Tufte amateur such as myself, I muscled in and helped her out with a cleaner version of the diagram. I’m dead chuffed to say that this was good enough to go live: take a gander at the Form Workflow Illustration.

I hope to make similar diagrams for core Drupal (in less depth) and PHPTemplate at some point, actually all my own work: watch this space.

Comments

Nice work, that makes things a lot clearer (all hail the Tufte), even though FAPI still makes my head hurt somewhat.

If you want a hand with any of the PHPTemplate stuff then just ping me and I'll see if I can help.

Thanks for that, Garrett. I'll probably get a mock-up together and run it by you to see how well it matches what's actually going on, as I really want the excuse to pull the code to bits!