diff options
author | Evan Winslow <evan.b.winslow@gmail.com> | 2010-10-21 17:46:39 +0000 |
---|---|---|
committer | Evan Winslow <evan.b.winslow@gmail.com> | 2010-10-21 17:46:39 +0000 |
commit | 9ff9d71952db26c06fe2eb1bf98b53340242e524 (patch) | |
tree | fa0a068d6a024d029246691c0c67f1b5e83d2ede | |
parent | 1bb750cdf821416584dc42206a29dae7c41144a5 (diff) | |
download | elgg-9ff9d71952db26c06fe2eb1bf98b53340242e524.tar.gz elgg-9ff9d71952db26c06fe2eb1bf98b53340242e524.tar.bz2 |
Removed html/tag view -- all we really needed was a function to form an attribute string from an array. This is now being used in each input view and there is not so much view nesting going on...
37 files changed, 193 insertions, 382 deletions
@@ -6,4 +6,66 @@ function html5_init() { elgg_extend_view('js/initialise_elgg', 'js/html5');
}
+function html5_get_html_attributes(array $attrs = array(), $quote_style = ENT_COMPAT, $charset = 'UTF-8', $double_encode = TRUE) {
+ $attrs = html5_clean_vars($attrs);
+ $attributes = array();
+
+ if (isset($attrs['js'])) {
+ elgg_deprecated_notice("Use of the 'js' attribute was deprecated in 1.8. You can now use the js attributes directly.", '1.8');
+
+ if (!empty($attrs['js'])) {
+ $attributes[] = $attrs['js'];
+ }
+
+ unset($attrs['js']);
+ }
+
+ foreach ($attrs as $attr => $val) {
+ $attr = strtolower($attr);
+
+ if ($val === TRUE) {
+ $attributes[] = $attr;
+ } elseif (!empty($val)) {
+ //allow multi-value attributes to be passed as array
+ if (is_array($val)) {
+ sort($val); //gzip?
+
+ $val = implode(' ', $val);
+ }
+
+ $val = htmlspecialchars($val, $quote_style, $charset, $double_encode);
+ $attributes[] = "$attr=\"$val\"";
+ }
+ }
+
+ sort($attributes); //gzip?
+
+ return implode(' ', $attributes);
+}
+
+// remove all the junk that elgg_view throws into $vars
+function html5_clean_vars(array $vars = array()) {
+ unset($vars['config']);
+ unset($vars['url']);
+ unset($vars['page_owner']);
+ unset($vars['page_owner_user']);
+
+ foreach ($_SESSION as $key => $value) {
+ unset($vars[$key]);
+ }
+
+ // backwards compatibility code
+ if (isset($vars['internalname'])) {
+ $vars['name'] = $vars['internalname'];
+ unset($vars['internalname']);
+ }
+
+ if (isset($vars['internalid'])) {
+ $vars['id'] = $vars['internalid'];
+ unset($vars['internalid']);
+ }
+
+ return $vars;
+}
+
register_elgg_event_handler('init', 'system', 'html5_init');
diff --git a/views/default/html/form.php b/views/default/html/form.php deleted file mode 100644 index b93c62051..000000000 --- a/views/default/html/form.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -$defaults = array( - 'method' => 'POST', - 'body' => '', -); - -$overrides = array( - 'tag' => 'form', -); - -echo elgg_view('html/tag', array_merge($defaults, $vars, $overrides));
\ No newline at end of file diff --git a/views/default/html/img.php b/views/default/html/img.php index 3560e066e..734e59a55 100644 --- a/views/default/html/img.php +++ b/views/default/html/img.php @@ -3,11 +3,9 @@ $defaults = array( 'alt' => '', 'title' => '', + 'border' => 0, ); -$overrides = array( - 'tag' => 'img', - 'body' => NULL, -); +$attributes = html5_get_html_attributes(array_merge($defaults, $vars)); -echo elgg_view('html/tag', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +echo "<img $attributes />";
\ No newline at end of file diff --git a/views/default/html/input.php b/views/default/html/input.php deleted file mode 100644 index 7350ae308..000000000 --- a/views/default/html/input.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -$defaults = array( - 'type' => 'text', -); - -$overrides = array( - 'tag' => 'input', -); - -$args = array_merge($defaults, $vars, $overrides); - -echo elgg_view('html/tag', $args);
\ No newline at end of file diff --git a/views/default/html/option.php b/views/default/html/option.php deleted file mode 100644 index b3d9bbc7f..000000000 --- a/views/default/html/option.php +++ /dev/null @@ -1 +0,0 @@ -<?php diff --git a/views/default/html/tag.php b/views/default/html/tag.php deleted file mode 100644 index 67a7d067c..000000000 --- a/views/default/html/tag.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -// remove all the junk that elgg_view throws into $vars - -unset($vars['config']); -unset($vars['url']); -unset($vars['page_owner']); -unset($vars['page_owner_user']); -foreach ($_SESSION as $key=>$value) { - unset($vars[$key]); -} - -// backwards compatibility code -if (isset($vars['internalname'])) { - //@todo put deprecated notice - $vars['name'] = $vars['internalname']; - unset($vars['internalname']); -} - -if (isset($vars['internalid'])) { - //@todo put deprecated notice - $vars['id'] = $vars['internalid']; - unset($vars['internalid']); -} - -$js = ''; -if (isset($vars['js'])) { - //@todo put deprecated notice - $js = $vars['js']; - unset($vars['js']); -} - -$tag = $vars['tag']; -unset($vars['tag']); - -$body = $vars['body']; -unset($vars['body']); - -//Build the input -$element = array(); - -$element[] = "<$tag"; -foreach ($vars as $attr => $val) { - if ($val === TRUE) { - $element[] = $attr; - } elseif (!empty($val)) { - $val = htmlspecialchars($val); - $element[] = "$attr=\"$val\""; - } -} - -if (!empty($js)) { - $element[] = $js; -} - -if (!isset($body)) { - $element[] = '/'; -} - -echo implode(" ", $element).">"; - -if (isset($body)) { - echo "$body</$tag>"; -}
\ No newline at end of file diff --git a/views/default/html/textarea.php b/views/default/html/textarea.php deleted file mode 100644 index 0c3813246..000000000 --- a/views/default/html/textarea.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -$defaults = array( - 'body' => '', - 'class' => 'input-textarea', -); - -$overrides = array( - 'tag' => 'textarea', -); - -if (isset($vars['value'])) { - $vars['body'] = $vars['value']; - unset($vars['value']); -} - -echo elgg_view('html/tag', array_merge($defaults, $vars, $overrides));
\ No newline at end of file diff --git a/views/default/input/button.php b/views/default/input/button.php index bda1d7bb3..ddf432562 100644 --- a/views/default/input/button.php +++ b/views/default/input/button.php @@ -1,9 +1 @@ -<?php
-
-$overrides = array(
- 'type' => 'button',
-);
-
-$args = array_merge($vars, $overrides);
-
-echo elgg_view('html/input', $args);
\ No newline at end of file +<input type="button" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/checkbox.php b/views/default/input/checkbox.php index c9a2c6498..5ba04a8cd 100644 --- a/views/default/input/checkbox.php +++ b/views/default/input/checkbox.php @@ -1,9 +1 @@ -<?php
-
-$overrides = array(
- 'type' => 'checkbox',
-);
-
-$args = array_merge($vars, $overrides);
-
-echo elgg_view('html/input', $args);
\ No newline at end of file +<input type="checkbox" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php index 816d65680..1e13b0687 100644 --- a/views/default/input/checkboxes.php +++ b/views/default/input/checkboxes.php @@ -25,32 +25,27 @@ $defaults = array( 'class' => 'input-checkboxes', - 'default' => 0, 'disabled' => FALSE, ); -$args = array_merge($defaults, $vars); +$vars = array_merge($defaults, $vars); -$value_array = (is_array($args['value'])) ? array_map('strtolower', $args['value']) : array(strtolower($args['value'])); +$value = $vars['value']; +unset($vars['value']); -$options = $args['options']; +$value_array = (is_array($value)) ? array_map('strtolower', $value) : array(strtolower($value)); + +$options = $vars['options']; +unset($vars['options']); if ($options) { - // include a default value so if nothing is checked 0 will be passed. - if ($args['internalname']) { - echo elgg_view('input/hidden', array('internalname' => $args['internalname'], 'value' => $args['default'])); - } - - foreach($options as $option => $label) { - $opts = array( - 'value' => $option, - 'checked' => in_array(strtolower($option), $value_array), - 'class' => $args['class'], - 'disabled' => $args['disabled'], - 'js' => $args['js'], - 'internalname' => $args['internalname'].'[]', - ); - - echo "<label>".elgg_view('input/checkbox', $opts)."$label</label><br />"; + foreach($options as $value => $label) { + echo "<label>"; + echo elgg_view('input/checkbox', array_merge($vars, array( + 'value' => $value, + 'internalname' => $vars['internalname'].'[]', + 'checked' => in_array(strtolower($value), $value_array), + ))); + echo "$label</label><br />"; } }
\ No newline at end of file diff --git a/views/default/input/color.php b/views/default/input/color.php index 07a364b50..76dd50603 100644 --- a/views/default/input/color.php +++ b/views/default/input/color.php @@ -1,11 +1 @@ -<?php
-
-$defaults = array(
- 'placeholder' => elgg_echo('placeholder:color'),
-);
-
-$overrides = array(
- 'type' => 'color',
-);
-
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="color" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/date.php b/views/default/input/date.php index 62014cb92..c408ea3a7 100644 --- a/views/default/input/date.php +++ b/views/default/input/date.php @@ -1,14 +1,6 @@ <?php
-$defaults = array(
- 'placeholder' => elgg_echo('placeholder:date'), //'yyyy-mm-dd',
-);
-
-$overrides = array(
- 'type' => 'date',
-);
-
if (isset($vars['value']) && is_int($vars['value'])) {
$vars['value'] = date("Y-m-d", $vars['value']);
}
-
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +?>
+<input type="date" <?php echo html5_get_html_attributes($vars); ?> />
diff --git a/views/default/input/datetime-local.php b/views/default/input/datetime-local.php index c9f0b32f9..e0ab4b171 100644 --- a/views/default/input/datetime-local.php +++ b/views/default/input/datetime-local.php @@ -1,14 +1,6 @@ <?php
-$defaults = array(
- 'placeholder' => elgg_echo('placeholder:datetime-local'), //'yyyy-mm-ddThh:mm:ss',
-);
-
-$overrides = array(
- 'type' => 'datetime-local',
-);
-
if (isset($vars['value']) && is_int($vars['value'])) {
$vars['value'] = date("Y-m-d\TH:i:s", $vars['value']);
}
-
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +?>
+<input type="datetime-local" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/datetime.php b/views/default/input/datetime.php index 7eecb62e8..eaa32634e 100644 --- a/views/default/input/datetime.php +++ b/views/default/input/datetime.php @@ -1,14 +1,6 @@ <?php
-$defaults = array(
- 'placeholder' => elgg_echo('placeholder:datetime'), //'yyyy-mm-ddThh:mm:ss+hh:mm',
-);
-
-$overrides = array(
- 'type' => 'datetime',
-);
-
if (isset($vars['value']) && is_int($vars['value'])) {
$vars['value'] = date("c", $vars['value']);
}
-
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +?>
+<input type="datetime" <?php echo html5_get_html_attributes($vars); ?> />
diff --git a/views/default/input/default.php b/views/default/input/default.php deleted file mode 100644 index cf9f64097..000000000 --- a/views/default/input/default.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php
-/**
- * Create an input field
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- *
- * @uses $vars['internalname'] The name of the input field
- * @uses $vars['internalid'] The id of the input field
- * @deprecated $vars['js'] Use named attributes instead
- *
- * All other input attributes can be specified using their attribute name
- * including javascript event attributes such as onclick.
- */
-
-//@todo put deprecated notice
-echo elgg_view('html/input', $vars);
\ No newline at end of file diff --git a/views/default/input/email.php b/views/default/input/email.php index 6d1bed19c..797fa582f 100644 --- a/views/default/input/email.php +++ b/views/default/input/email.php @@ -1,12 +1 @@ -<?php
-$defaults = array(
- 'placeholder' => elgg_echo('placeholder:email'),
-);
-
-$overrides = array(
- 'type' => 'email',
-);
-
-$args = array_merge($defaults, $vars, $overrides);
-
-echo elgg_view('html/input', $args);
\ No newline at end of file +<input type="email" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/file.php b/views/default/input/file.php index ef7223a80..9df286890 100644 --- a/views/default/input/file.php +++ b/views/default/input/file.php @@ -1,11 +1 @@ -<?php
-
-$defaults = array(
-
-);
-
-$overrides = array(
- 'type' => 'file',
-);
-
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="file" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/form.php b/views/default/input/form.php index c30dd5c9a..565db3afe 100644 --- a/views/default/input/form.php +++ b/views/default/input/form.php @@ -10,17 +10,24 @@ * @link http://elgg.org/ * * @uses $vars['body'] The body of the form (made up of other input/xxx views and html - * @uses $vars['method'] Method (default POST) - * @uses $vars['enctype'] How the form is encoded, default blank - * @uses $vars['action'] URL of the action being called * @uses $vars['disable_security'] Force the securitytokens not to be added to this form (@todo what's the point??) * */ +$defaults = array( + 'body' => '', + 'method' => 'POST', +); + +$vars = array_merge($defaults, $vars); if ($vars['disable_security'] != TRUE) { - $vars['body'] .= elgg_view('input/securitytoken'); + $body .= elgg_view('input/securitytoken'); } - unset($vars['disable_security']); -echo elgg_view('html/form', $vars); +$body = $vars['body']; +unset($vars['body']); + +$attributes = html5_get_html_attributes($vars); + +echo "<form $attributes>$body</form>"; diff --git a/views/default/input/hidden.php b/views/default/input/hidden.php index da1e9bd00..944382616 100644 --- a/views/default/input/hidden.php +++ b/views/default/input/hidden.php @@ -1,11 +1 @@ -<?php
-
-$defaults = array(
-
-);
-
-$overrides = array(
- 'type' => 'hidden',
-);
-
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="hidden" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/image.php b/views/default/input/image.php index f1b07cb8e..ae65d86ca 100644 --- a/views/default/input/image.php +++ b/views/default/input/image.php @@ -1,11 +1 @@ -<?php
-
-$defaults = array(
-
-);
-
-$overrides = array(
- 'type' => 'image',
-);
-
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="image" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/longtext.php b/views/default/input/longtext.php index 6366f8a3d..1020ef640 100644 --- a/views/default/input/longtext.php +++ b/views/default/input/longtext.php @@ -18,4 +18,9 @@ $defaults = array( 'class' => 'input-richtext', ); -echo elgg_view('html/textarea', array_merge($defaults, $vars));
\ No newline at end of file +$value = $vars['value']; +unset($vars['value']); + +$attributes = html5_get_html_attributes(array_merge($defaults, $vars)); + +echo "<textarea $attributes>$value</textarea>";
\ No newline at end of file diff --git a/views/default/input/month.php b/views/default/input/month.php index 071d40262..4bd320046 100644 --- a/views/default/input/month.php +++ b/views/default/input/month.php @@ -1,14 +1,7 @@ <?php
-$defaults = array(
- 'placeholder' => elgg_echo('placeholder:month'),
-);
-
-$overrides = array(
- 'type' => 'month',
-);
-
if (isset($vars['value']) && is_int($vars['value'])) {
$vars['value'] = date("Y-m", $vars['value']);
}
+?>
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="month" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/number.php b/views/default/input/number.php index fbd1bec72..ccfb72641 100644 --- a/views/default/input/number.php +++ b/views/default/input/number.php @@ -1,11 +1 @@ -<?php
-
-$defaults = array(
-
-);
-
-$overrides = array(
- 'type' => 'number',
-);
-
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="number" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/option.php b/views/default/input/option.php index 2955f1cb9..f420c9be4 100644 --- a/views/default/input/option.php +++ b/views/default/input/option.php @@ -1,21 +1,13 @@ <?php -$defaults = array( +$text = $vars['text']; -); - -$overrides = array( - 'tag' => 'option', -); - -$args = array_merge($defaults, $vars, $overrides); - -if (!isset($args['body'])) { - $args['body'] = $args['value']; +if (!isset($text)) { + $text = $vars['value']; + unset($vars['value']); } -if (isset($args['body'])) { - $args['body'] = htmlentities($args['body'], ENT_QUOTES, 'UTF-8'); -} +$text = htmlentities($text, ENT_QUOTES, 'UTF-8'); +$attributes = html5_get_html_attributes($vars); -echo elgg_view('html/tag', $args);
\ No newline at end of file +echo "<option $attributes>$text</option>";
\ No newline at end of file diff --git a/views/default/input/password.php b/views/default/input/password.php index 609b39faa..8c97cf020 100644 --- a/views/default/input/password.php +++ b/views/default/input/password.php @@ -1,11 +1 @@ -<?php
-
-$defaults = array(
- 'placeholder' => elgg_echo('placeholder:password'),
-);
-
-$overrides = array(
- 'type' => 'password',
-);
-
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="password" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/plaintext.php b/views/default/input/plaintext.php index 1d907dcfc..cd0a7d6b5 100644 --- a/views/default/input/plaintext.php +++ b/views/default/input/plaintext.php @@ -1,6 +1,22 @@ <?php /** - * + * Elgg long text input + * Displays a long text input field + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * */ -echo elgg_view('html/textarea', $vars);
\ No newline at end of file +$defaults = array( + 'class' => 'input-plaintext', +); + +$value = $vars['value']; +unset($vars['value']); + +$attributes = html5_get_html_attributes(array_merge($defaults, $vars)); + +echo "<textarea $attributes>$value</textarea>";
\ No newline at end of file diff --git a/views/default/input/pulldown.php b/views/default/input/pulldown.php index 49c126c77..8a30838d4 100644 --- a/views/default/input/pulldown.php +++ b/views/default/input/pulldown.php @@ -9,9 +9,6 @@ * @author Curverider Ltd * @link http://elgg.org/ * - * @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['options'] An array of strings representing the options for the pulldown field * @uses $vars['options_values'] An associative array of "value" => "option" where "value" is an internal name and "option" is * the value displayed on the button. Replaces $vars['options'] when defined. @@ -21,35 +18,35 @@ $defaults = array( 'class' => 'input-pulldown', ); -$overrides = array( - 'tag' => 'select', -); +$vars = array_merge($defaults, $vars); + +$options_values = $vars['options_values']; +unset($vars['options_values']); -$args = array_merge($defaults, $vars, $overrides); +$options = $vars['options']; +unset($options); -$body = ''; +$value = $vars['value']; +unset($vars['value']); +?> -if ($vars['options_values']) { - foreach($vars['options_values'] as $value => $option) { - $option_args = array( - 'value' => $value, - 'body' => $option, - 'selected' => ($value == $args['value']), - ); - - $body .= elgg_view('input/option', $option_args); +<select <?php echo html5_get_html_attributes($vars); ?>> +<?php +if ($options_values) { + foreach($options_values as $opt_val => $opt_text) { + echo elgg_view('input/option', array( + 'value' => $opt_val, + 'text' => $opt_text, + 'selected' => ($opt_val == $value), + )); } } else { - foreach($vars['options'] as $option) { - $option_args = array( - 'body' => $option, - 'selected' => ($option == $args['value']), - ); - - $body .= elgg_view('input/option', $option_args); + foreach($options as $option) { + echo elgg_view('input/option', array( + 'text' => $option, + 'selected' => ($option == $value), + )); } } - -$args['body'] = $body; - -echo elgg_view('html/tag', $args); +?> +</select>
\ No newline at end of file diff --git a/views/default/input/range.php b/views/default/input/range.php index 8fedf067a..588b835d1 100644 --- a/views/default/input/range.php +++ b/views/default/input/range.php @@ -4,8 +4,7 @@ $defaults = array( );
-$overrides = array(
- 'type' => 'range',
-);
+$vars = array_merge($defaults, $vars);
+?>
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="range" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/reset.php b/views/default/input/reset.php index 911c6671b..b1c7c06ed 100644 --- a/views/default/input/reset.php +++ b/views/default/input/reset.php @@ -4,8 +4,7 @@ $defaults = array( 'value' => elgg_echo('reset'),
);
-$overrides = array(
- 'type' => 'reset',
-);
+$vars = array_merge($defaults, $vars);
+?>
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="reset" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/search.php b/views/default/input/search.php index 457c45999..47988be51 100644 --- a/views/default/input/search.php +++ b/views/default/input/search.php @@ -4,8 +4,7 @@ $defaults = array( 'placeholder' => elgg_echo('placeholder:search'),
);
-$overrides = array(
- 'type' => 'search',
-);
+$vars = array_merge($defaults, $vars);
+?>
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="search" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/submit.php b/views/default/input/submit.php index a0cd1cfac..4c86f6c66 100644 --- a/views/default/input/submit.php +++ b/views/default/input/submit.php @@ -4,10 +4,7 @@ $defaults = array( 'value' => elgg_echo('submit'),
);
-$overrides = array(
- 'type' => 'submit',
-);
-
-$args = array_merge($vars, $overrides);
+$vars = array_merge($defaults, $vars);
+?>
-echo elgg_view('html/input', $args);
\ No newline at end of file +<input type="submit" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/tags.php b/views/default/input/tags.php index 952134db0..3f5e2481a 100644 --- a/views/default/input/tags.php +++ b/views/default/input/tags.php @@ -9,14 +9,8 @@ * @link http://elgg.org/ * * @uses $vars['value'] The current value, if any - string or array - tags will be encoded - * @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 override - * @uses $vars['disabled'] Is the input field disabled? */ - $defaults = array( 'class' => 'input-tags', 'placeholder' => elgg_echo('placeholder:tags'), diff --git a/views/default/input/tel.php b/views/default/input/tel.php index 1bb146ce5..441e85bf0 100644 --- a/views/default/input/tel.php +++ b/views/default/input/tel.php @@ -1,11 +1,9 @@ <?php
-
$defaults = array(
'placeholder' => elgg_echo('placeholder:tel'),
);
-$overrides = array(
- 'type' => 'tel',
-);
+$vars = array_merge($defaults, $vars);
+?>
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="tel" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/text.php b/views/default/input/text.php index 0993d1f2b..b84d3d16f 100644 --- a/views/default/input/text.php +++ b/views/default/input/text.php @@ -4,8 +4,7 @@ $defaults = array( 'placeholder' => elgg_echo('placeholder:text'),
);
-$overrides = array(
- 'type' => 'text',
-);
+$vars = array_merge($defaults, $vars);
+?>
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="text" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/time.php b/views/default/input/time.php index 3d714ccc1..641dd5244 100644 --- a/views/default/input/time.php +++ b/views/default/input/time.php @@ -4,8 +4,7 @@ $defaults = array( 'placeholder' => elgg_echo('placeholder:time'),
);
-$overrides = array(
- 'type' => 'time',
-);
+$vars = array_merge($defaults, $vars);
+?>
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="time" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/url.php b/views/default/input/url.php index 60d8820e7..a0851f4d9 100644 --- a/views/default/input/url.php +++ b/views/default/input/url.php @@ -4,10 +4,7 @@ $defaults = array( 'placeholder' => elgg_echo('placeholder:url'),
);
-$overrides = array(
- 'type' => 'url',
-);
-
-$args = array_merge($vars, $overrides);
+$vars = array_merge($defaults, $vars);
+?>
-echo elgg_view('html/input', $args);
\ No newline at end of file +<input type="url" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/week.php b/views/default/input/week.php index 294811aee..d921755a9 100644 --- a/views/default/input/week.php +++ b/views/default/input/week.php @@ -4,8 +4,7 @@ $defauts = array( 'placeholder' => elgg_echo('placeholder:week'),
);
-$overrides = array(
- 'type' => 'week',
-);
+$vars = array_merge($defaults, $vars);
+?>
-echo elgg_view('html/input', array_merge($defaults, $vars, $overrides));
\ No newline at end of file +<input type="week" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file |