diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-23 00:50:25 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-23 00:50:25 +0000 |
commit | b3d640c57802c14760072032bebd2076cbd1bb35 (patch) | |
tree | a98754029819b09d2f4cdbeba57e241dc215972b /views/default/input/checkbox.php | |
parent | 64aac7499efec62ba1da5f5b533042d3365cc50f (diff) | |
download | elgg-b3d640c57802c14760072032bebd2076cbd1bb35.tar.gz elgg-b3d640c57802c14760072032bebd2076cbd1bb35.tar.bz2 |
Fixes #397 and Refs #2396 Can suppress the default value for both input/checkbox and input/checkboxes
git-svn-id: http://code.elgg.org/elgg/trunk@7424 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/input/checkbox.php')
-rw-r--r-- | views/default/input/checkbox.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/views/default/input/checkbox.php b/views/default/input/checkbox.php index 32bc323fd..e70064ddb 100644 --- a/views/default/input/checkbox.php +++ b/views/default/input/checkbox.php @@ -1,10 +1,17 @@ <?php /** * Elgg checkbox input - * Displays a checkbox input field + * Displays a checkbox input tag * * @package Elgg * @subpackage Core + * + * + * Pass input tag attributes as key value pairs. For a list of allowable + * attributes, see http://www.w3schools.com/tags/tag_input.asp + * + * @uses mixed $vars['default'] The default value to submit if not checked. + * Optional, defaults to 0. Set to false for no default. */ $defaults = array( @@ -13,6 +20,17 @@ $defaults = array( $vars = array_merge($defaults, $vars); +if (isset($vars['default'])) { + $default = $vars['default']; + unset($vars['default']); +} else { + $default = 0; +} + +if (isset($vars['name']) && $default !== false) { + echo "<input type=\"hidden\" name=\"{$vars['name']}\" value=\"$default\"/>"; +} + ?> <input type="checkbox" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file |