I'm developing a moderately complex module to enhance Drupal's accessibility. Among other things, I want to give site administrators the ability to define customized "skip links" leading to each region supported by whatever theme they happen to be using. Each skip link requires two things: some link text for the link, and, optionally, an access key so that blind users can trigger the link at any time using a keyboard shortcut.

In order to convey these settings sanely, I need a highly customized form, and system_settings_form() doesn't appear to allow for much in the way of customization. What I really want is something like this mockup. If I were just doing the five default regions, I could get away with a default form produced by the Form API. But one of the themes I have to support is Tapestry, which offers THIRTY customizable regions. With that many regions, using Drupal's default theme output would yield a thoroughly confusing, disorganized settings page.

I've tried creating a custom form theming function using drupal_render() to render the appropriate bits of things, but it turns out that you can't return a finished form as the output of the module_admin_settings() function. It has to return an array of form data, which seriously limits the ways I can control the form output. I suppose I could try doing some seriously complicated #prefix #suffix stuff, but that's awfully clunky.

So - how do I make a customized settings page? Is there some way I could define a template file for my system settings form? That would be ideal.

Comments

wdmartin’s picture

I managed to get it working using #prefix and #suffix, but the code is ugly as sin and a pain in the butt to work with. If anybody knows a better method, I'm all ears!