aboutsummaryrefslogtreecommitdiff
path: root/views/default/input/checkboxes.php
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/input/checkboxes.php')
-rw-r--r--views/default/input/checkboxes.php44
1 files changed, 12 insertions, 32 deletions
diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php
index adfe19914..46254633b 100644
--- a/views/default/input/checkboxes.php
+++ b/views/default/input/checkboxes.php
@@ -52,44 +52,24 @@ if ($options) {
$label = $option;
}
- if (!in_array(strtolower($option), $value_array)) {
- $selected = FALSE;
- } else {
- $selected = TRUE;
- }
-
- $attr = array(
- 'type="checkbox"',
- 'value="' . htmlentities($option, ENT_QUOTES, 'UTF-8') . '"'
+ $input_vars = array(
+ 'checked' => in_array(strtolower($option), $value_array),
+ 'value' => $option,
+ 'disabled' => $disabled,
+ 'id' => $id,
+ 'js' => $js,
);
-
- if ($id) {
- $attr[] = "id=\"$id\"";
- }
-
+
if ($class) {
- $attr[] = "class=\"$class\"";
- }
-
- if ($disabled) {
- $attr[] = 'disabled="yes"';
- }
-
- if ($selected) {
- $attr[] = 'checked = "checked"';
- }
-
- if ($js) {
- $attr[] = $js;
+ $input_vars['class'] = $class;
}
if ($internalname) {
- // @todo this really, really should only add the []s if there are > 1 element in options.
- $attr[] = "name=\"{$internalname}[]\"";
+ $input_vars['name'] = "{$internalname}[]";
}
+
+ $input = elgg_view('input/checkbox', $input_vars);
- $attr_str = implode(' ', $attr);
-
- echo "<label><input $attr_str />$label</label><br />";
+ echo "<label>{$input}{$label}</label><br />";
}
} \ No newline at end of file