]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #2143: DRYed up input/file
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 12 Feb 2011 03:59:57 +0000 (03:59 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 12 Feb 2011 03:59:57 +0000 (03:59 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8141 36083f99-b078-4883-b0ff-0f9b5a30f544

views/default/input/file.php

index 28ab54f940316beb3e5e54d5e26513301d78bf78..4c42042e8c1d1c97c584231e14e9c4a5972e3a4e 100644 (file)
@@ -6,11 +6,6 @@
  * @package Elgg
  * @subpackage Core
  *
- * @uses $vars['js'] Any Javascript to enter into the input tag
- * @uses $vars['internalname'] The name of the input field
- * @uses $vars['internalid'] The id of the input field
- * @uses $vars['class'] CSS class
- * @uses $vars['disabled'] Is the input field disabled?
  * @uses $vars['value'] The current value if any
  *
  */
@@ -19,15 +14,13 @@ if (!empty($vars['value'])) {
        echo elgg_echo('fileexists') . "<br />";
 }
 
-$class = "elgg-input-file";
-if (isset($vars['class'])) {
-       $class = $vars['class'];
-}
+$defaults = array(
+       'class' => 'elgg-input-file',
+       'disabled' => FALSE,
+       'size' => 30,   
+);
 
-$disabled = false;
-if (isset($vars['disabled'])) {
-       $disabled = $vars['disabled'];
-}
+$attrs = array_merge($defaults, $vars);
 
 ?>
-<input type="file" size="30" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> <?php if ($disabled) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>" />
\ No newline at end of file
+<input type="file"  <?php echo elgg_format_attributes($attrs)?> />
\ No newline at end of file