summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index d4e8d6b45..71e4da38c 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1034,6 +1034,19 @@ function form_checkbox($title, $name, $value = 1, $checked = 0, $description = N
return form_hidden($name, 0) . theme('form_element', NULL, $element, $description, $required);
}
+function form_checkboxes($title, $name, $values, $options, $description = NULL, $required = FALSE) {
+ if (count($options) > 0) {
+ if (!isset($values)) {
+ $values = array();
+ }
+ $choices = '';
+ foreach ($options as $key => $choice) {
+ $choices .= "<label class=\"option\"><input type=\"checkbox\" class=\"form-checkbox\" name=\"edit[$name][]\" value=\"$key\"". (in_array($key, $values) ? " checked=\"checked\"" : "") ." /> $choice</label><br />";
+ }
+ return theme('form_element', $title, $choices, $description, $required);
+ }
+}
+
function form_textfield($title, $name, $value, $size, $maxlength, $description = NULL, $attributes = NULL, $required = FALSE) {
$size = $size ? " size=\"$size\"" : "";
return theme("form_element", $title, "<input type=\"text\" maxlength=\"$maxlength\" class=\"form-text\" name=\"edit[$name]\" id=\"$name\"$size value=\"". check_form($value) ."\"". drupal_attributes($attributes) ." />", $description, $name, $required);