diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 4 | ||||
-rw-r--r-- | includes/theme.inc | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/includes/common.inc b/includes/common.inc index 674419619..6a4e82a3c 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -764,10 +764,10 @@ function form_select($title, $name, $value, $options, $description = NULL, $extr function form_radios($title, $name, $value, $options, $description = NULL) { if (count($options) > 0) { - foreach ($options as $key=>$choice) { + foreach ($options as $key => $choice) { $output .= form_radio($choice, $name, $key, ($key == $value)); } - return theme("form_element", $title, $output, $description); + return theme("form_element", $title, $output, $description, $name); } } diff --git a/includes/theme.inc b/includes/theme.inc index edf1c0d23..c849c9fd1 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -274,6 +274,7 @@ function theme_node($node, $main = 0, $page = 0) { * @param $title the form element's title * @param $value the form element's data * @param $description the form element's description or explanation + * @param $id the form element's ID used by the <label> tag * * @return a string containing the @a node output. */ @@ -288,12 +289,18 @@ function theme_form_element($title, $value, $description = NULL, $id = NULL) { $title = "<label>$title:</label><br />"; } } + else { + if ($id) { + $title = "<label for=\"$id\"></label>"; + // TODO: does this make sense to do? + } + } if ($description) { $description = "<div class=\"description\">$description</div>"; } - return "<div class=\"form-item\">$title $value $description</div>\n"; + return "<div class=\"form-item\">". $title . $value . $description ."</div>\n"; } /** |