]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #2143: DRY up input/text
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 20 Nov 2010 06:27:51 +0000 (06:27 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 20 Nov 2010 06:27:51 +0000 (06:27 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7357 36083f99-b078-4883-b0ff-0f9b5a30f544

views/default/input/text.php

index ea35efe2aeefbaf65ca0f19b28a03b94d521ba9e..3e8de2c351aa6fc77bc1672b5d50aabdab1da1b0 100644 (file)
@@ -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