summaryrefslogtreecommitdiff
path: root/includes/theme.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-12-22 14:45:00 +0000
committerDries Buytaert <dries@buytaert.net>2003-12-22 14:45:00 +0000
commit54a74abaa3c803ca83bae60fbb8b93041b96afe0 (patch)
treec5fa92da9f0f467b464bfbb1e07e195d37583ef9 /includes/theme.inc
parentbf51896e859665547b322727325c8abf10e77982 (diff)
downloadbrdo-54a74abaa3c803ca83bae60fbb8b93041b96afe0.tar.gz
brdo-54a74abaa3c803ca83bae60fbb8b93041b96afe0.tar.bz2
- Accessibility improvements: made the <label>-tags use the 'for'-attribute.
Diffstat (limited to 'includes/theme.inc')
-rw-r--r--includes/theme.inc18
1 files changed, 16 insertions, 2 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index b1583d118..edf1c0d23 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -278,8 +278,22 @@ function theme_node($node, $main = 0, $page = 0) {
* @return a string containing the @a node output.
*/
-function theme_form_element($title, $value, $description = 0) {
- return "<div class=\"form-item\">". ($title ? "<label>$title:</label><br />" : "") . $value . ($description ? "<div class=\"description\">$description</div>" : "") ."</div>\n";
+function theme_form_element($title, $value, $description = NULL, $id = NULL) {
+
+ if ($title) {
+ if ($id) {
+ $title = "<label for=\"$id\">$title:</label><br />";
+ }
+ else {
+ $title = "<label>$title:</label><br />";
+ }
+ }
+
+ if ($description) {
+ $description = "<div class=\"description\">$description</div>";
+ }
+
+ return "<div class=\"form-item\">$title $value $description</div>\n";
}
/**