Commit 770174b2 authored by Dries's avatar Dries

- Updated documentation, small bug fix and small improvements to the <label>
  tags.

  To be discussed and investigated: when a form element has no title an empty
  <label> tag will be emitted (eg. "remember me" checkbox).  This doesn't make
  sense but is our best option for now.
parent 8f226513
......@@ -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);
}
}
......
......@@ -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 &lt;label&gt; 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";
}
/**
......
......@@ -675,7 +675,7 @@ function user_login($edit = array(), $msg = "") {
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Enter your %s username.", array("%s" => variable_get("site_name", "local"))));
}
$output .= form_password(t("Password"), "pass", $pass, 30, 64, t("Enter the password that accompanies your username."));
$output .= form_checkbox(t("Remember me"), "remember_me", 1, 0, 0);
$output .= form_checkbox(t("Remember me"), "remember_me");
$output .= form_submit(t("Log in"));
$items[] = l(t("Request new password"), "user/password");
if (variable_get("user_register", 1)) {
......
......@@ -675,7 +675,7 @@ function user_login($edit = array(), $msg = "") {
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Enter your %s username.", array("%s" => variable_get("site_name", "local"))));
}
$output .= form_password(t("Password"), "pass", $pass, 30, 64, t("Enter the password that accompanies your username."));
$output .= form_checkbox(t("Remember me"), "remember_me", 1, 0, 0);
$output .= form_checkbox(t("Remember me"), "remember_me");
$output .= form_submit(t("Log in"));
$items[] = l(t("Request new password"), "user/password");
if (variable_get("user_register", 1)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment