diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-20 06:27:51 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-20 06:27:51 +0000 |
commit | 70faa7d64b3d992e6909019a2023ac5a62ab8b41 (patch) | |
tree | 5374ba189bca269d89ac65998ef21505e87c9e8e /views/default/input | |
parent | 1ec293a95a94e07cc8084aeca1b54dd3486e8895 (diff) | |
download | elgg-70faa7d64b3d992e6909019a2023ac5a62ab8b41.tar.gz elgg-70faa7d64b3d992e6909019a2023ac5a62ab8b41.tar.bz2 |
Refs #2143: DRY up input/text
git-svn-id: http://code.elgg.org/elgg/trunk@7357 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/input')
-rw-r--r-- | views/default/input/text.php | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/views/default/input/text.php b/views/default/input/text.php index ea35efe2a..3e8de2c35 100644 --- a/views/default/input/text.php +++ b/views/default/input/text.php @@ -5,34 +5,18 @@ * * @package Elgg * @subpackage Core - - - * - * @uses $vars['value'] The current value, if any - * @uses $vars['js'] Any Javascript to enter into the input tag - * @uses $vars['internalname'] The name of the input field - * @uses $vars['disabled'] If true then control is read-only - * @uses $vars['class'] Class override */ +$defaults = array( + 'class' => 'input_text', + 'disabled' => FALSE, +); -if (isset($vars['class'])) { - $class = $vars['class']; -} else { - $class = "input_text"; -} - -$disabled = false; -if (isset($vars['disabled'])) { - $disabled = $vars['disabled']; -} +$vars = array_merge($defaults, $vars); if (!isset($vars['value']) || $vars['value'] === FALSE) { $vars['value'] = elgg_get_sticky_value($vars['internalname']); } - -$value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); - ?> -<input type="text" <?php if ($disabled) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> value="<?php echo $value; ?>" class="<?php echo $class ?>"/>
\ No newline at end of file +<input type="text" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file |