diff options
author | Evan Winslow <evan.b.winslow@gmail.com> | 2010-10-21 17:46:39 +0000 |
---|---|---|
committer | Evan Winslow <evan.b.winslow@gmail.com> | 2010-10-21 17:46:39 +0000 |
commit | 9ff9d71952db26c06fe2eb1bf98b53340242e524 (patch) | |
tree | fa0a068d6a024d029246691c0c67f1b5e83d2ede /views/default/input/checkboxes.php | |
parent | 1bb750cdf821416584dc42206a29dae7c41144a5 (diff) | |
download | elgg-9ff9d71952db26c06fe2eb1bf98b53340242e524.tar.gz elgg-9ff9d71952db26c06fe2eb1bf98b53340242e524.tar.bz2 |
Removed html/tag view -- all we really needed was a function to form an attribute string from an array. This is now being used in each input view and there is not so much view nesting going on...
Diffstat (limited to 'views/default/input/checkboxes.php')
-rw-r--r-- | views/default/input/checkboxes.php | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php index 816d65680..1e13b0687 100644 --- a/views/default/input/checkboxes.php +++ b/views/default/input/checkboxes.php @@ -25,32 +25,27 @@ $defaults = array( 'class' => 'input-checkboxes', - 'default' => 0, 'disabled' => FALSE, ); -$args = array_merge($defaults, $vars); +$vars = array_merge($defaults, $vars); -$value_array = (is_array($args['value'])) ? array_map('strtolower', $args['value']) : array(strtolower($args['value'])); +$value = $vars['value']; +unset($vars['value']); -$options = $args['options']; +$value_array = (is_array($value)) ? array_map('strtolower', $value) : array(strtolower($value)); + +$options = $vars['options']; +unset($vars['options']); if ($options) { - // include a default value so if nothing is checked 0 will be passed. - if ($args['internalname']) { - echo elgg_view('input/hidden', array('internalname' => $args['internalname'], 'value' => $args['default'])); - } - - foreach($options as $option => $label) { - $opts = array( - 'value' => $option, - 'checked' => in_array(strtolower($option), $value_array), - 'class' => $args['class'], - 'disabled' => $args['disabled'], - 'js' => $args['js'], - 'internalname' => $args['internalname'].'[]', - ); - - echo "<label>".elgg_view('input/checkbox', $opts)."$label</label><br />"; + foreach($options as $value => $label) { + echo "<label>"; + echo elgg_view('input/checkbox', array_merge($vars, array( + 'value' => $value, + 'internalname' => $vars['internalname'].'[]', + 'checked' => in_array(strtolower($value), $value_array), + ))); + echo "$label</label><br />"; } }
\ No newline at end of file |