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

views/default/input/email.php

index efe2c5848191dda137229b9b1b3ef10fb978c915..81e61747611dea16c516ae16f12d402e4cffc0d5 100644 (file)
@@ -5,24 +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
- *
  */
 
-$class = $vars['class'];
-if (!$class) {
-       $class = "input_text";
-}
+$defaults = array(
+       'class' => 'input_text', //@todo input_email?
+       'disabled' => FALSE,
+);
+
+$vars = array_merge($defaults, $vars);
 
 if (!isset($vars['value']) || $vars['value'] === FALSE) {
        $vars['value'] = elgg_get_sticky_value($vars['internalname']);
 }
-
 ?>
 
-<input type="text" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?>value="<?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?>" 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