Moving the help text in forms
In Szeged at William Lawrence's session on Accessibility Best Practices in Drupal Theming we talked about moving the form "help" text so that it was between the form label and the form widget (by default it's below). We also talked about having a control option (per field) that would allow you to select whether the help text was displayed above or below the form widget.
I didn't get the control working, but with the help of chx and moonshine on IRC I was able to get the help text to appear above the form widgets instead of their default location, below. I correctly identified the function that controls "regular" form elements, but I was having a hard time tracking down the function for multiple form elements (used for CCK imagefield with lots of images uploaded). They pointed me in the right direction! Yay! If you want to get this working on your site too you need to copy two functions into your theme's template.php file and adjust the output as described below.
Regular form elements
Function used: theme_form_element
What you need to change: swap the $value and the "description" output lines so that the description is attached to $output ahead of $value.
Multiple form values (e.g. imagefield)
Function used: theme_content_multiple_values
What you need to change: move $description from the bottom (ish) of the function to the top. Add the $description to the $header via the data array key. Like this:
'data' => t('!title: !required', array('!title' => $element['#title'], '!required' => $required)).$description,
Update I have also created a feature request to have this as a toggle option when new content fields are created.


Comments
Leave your feedback at the bottom. Comments may be held in moderation.