From 3d95a51f3f8771d9c52c888bcc4eddf88f18a8ca Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 12 Feb 2011 14:02:11 +0000 Subject: Fixes #972 checkboxes and radio input fields support horizontal and vertical alignments git-svn-id: http://code.elgg.org/elgg/trunk@8154 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/input/checkboxes.php | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'views/default/input/checkboxes.php') diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php index 2ca48459d..85c44de54 100644 --- a/views/default/input/checkboxes.php +++ b/views/default/input/checkboxes.php @@ -14,20 +14,21 @@ * (Forced to an array by appending []) * @uses array $vars['options'] An array of strings representing the * label => option for the each checkbox field - * @uses string $vars['internalid'] The id for each input field. Optional + * @uses string $vars['internalid'] The id for each input field. Optional. * (Only use this with a single value.) * @uses string $vars['default'] The default value to send if nothing is checked. * Optional, defaults to 0. Set to FALSE for no default. * @uses bool $vars['disabled'] Make all input elements disabled. Optional. * @uses string $vars['value'] The current value. Optional. - * @uses string $vars['class'] The class of each input element. Optional. - * @uses string $vars['js'] Any Javascript to enter into the input tag. Optional. + * @uses string $vars['class'] Additional class of the list. Optional. + * @uses string $vars['align'] 'horizontal' or 'vertical' Default: 'vertical' * */ -$class = (isset($vars['class'])) ? $vars['class'] : 'elgg-input-checkboxes'; +$additional_class = elgg_get_array_value('class', $vars); +$align = elgg_get_array_value('align', $vars, 'vertical'); $value = (isset($vars['value'])) ? $vars['value'] : NULL; -$value_array = (is_array($value)) ? array_map('strtolower', $value) : array(strtolower($value)); +$value_array = (is_array($value)) ? array_map('elgg_strtolower', $value) : array(elgg_strtolower($value)); $internalname = (isset($vars['internalname'])) ? $vars['internalname'] : ''; $options = (isset($vars['options']) && is_array($vars['options'])) ? $vars['options'] : array(); $default = (isset($vars['default'])) ? $vars['default'] : 0; @@ -36,34 +37,33 @@ $id = (isset($vars['internalid'])) ? $vars['internalid'] : ''; $disabled = (isset($vars['disabled'])) ? $vars['disabled'] : FALSE; $js = (isset($vars['js'])) ? $vars['js'] : ''; -if ($options) { +$class = "elgg-input-checkboxes elgg-$align"; +if ($additional_class) { + $class = " $additional_class"; +} + +if ($options && count($options) > 0) { // include a default value so if nothing is checked 0 will be passed. if ($internalname && $default !== FALSE) { echo ""; } + echo "'; } \ No newline at end of file -- cgit v1.2.3