| 5 form.inc | theme_form_element($element, $value) |
| 6 form.inc | theme_form_element( |
| 7 form.inc | theme_form_element($variables) |
| 8 form.inc | theme_form_element($variables) |
Return a themed form element.
Parameters
$title the form element's title:
$value the form element's data:
$description the form element's description or explanation:
$id the form element's ID used by the <label> tag:
$required a boolean to indicate whether this is a required field or not:
$error a string with an error message filed against this form element:
Return value
a string representing the form element
Related topics
11 theme calls to theme_form_element()
File
- includes/
theme.inc, line 554 - The theme system, which controls the output of Drupal.
Code
function theme_form_element($title, $value, $description = NULL, $id = NULL, $required = FALSE, $error = FALSE) {
$output = "<div class=\"form-item\">\n";
$required = $required ? '<span class="form-required">*</span>' : '';
if ($title) {
if ($id) {
$output .= " <label for=\"$id\">$title:</label>$required<br />\n";
}
else {
$output .= " <label>$title:</label>$required<br />\n";
}
}
$output .= " $value\n";
if ($description) {
$output .= " <div class=\"description\">$description</div>\n";
}
$output .= "</div>\n";
return $output;
}
Login or register to post comments