made all form helpers consistent regarding extra attributes
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 53ee8eb..c77069c 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -197,7 +197,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_input($data = '', $value = '', $extra = '')
@@ -208,6 +208,8 @@
'value' => $value
);
+ $extra = _attributes_to_string($extra);
+
return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
}
}
@@ -223,7 +225,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_password($data = '', $value = '', $extra = '')
@@ -245,7 +247,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_upload($data = '', $value = '', $extra = '')
@@ -253,6 +255,9 @@
$defaults = array('type' => 'file', 'name' => '');
is_array($data) OR $data = array('name' => $data);
$data['type'] = 'file';
+
+ $extra = _attributes_to_string($extra);
+
return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
}
}
@@ -266,7 +271,7 @@
*
* @param mixed $data
* @param string $value
- * @param string $extra
+ * @param mixed $extra
* @return string
*/
function form_textarea($data = '', $value = '', $extra = '')
@@ -287,6 +292,8 @@
unset($data['value']); // textareas don't use the value attribute
}
+ $extra = _attributes_to_string($extra);
+
return '<textarea '._parse_form_attributes($data, $defaults).$extra.'>'.html_escape($val)."</textarea>\n";
}
}
@@ -301,11 +308,13 @@
* @param string
* @param array
* @param mixed
- * @param string
+ * @param mixed
* @return string
*/
function form_multiselect($name = '', $options = array(), $selected = array(), $extra = '')
{
+ $extra = _attributes_to_string($extra);
+
if ( ! strpos($extra, 'multiple'))
{
$extra .= ' multiple="multiple"';
@@ -420,7 +429,7 @@
* @param mixed
* @param string
* @param bool
- * @param string
+ * @param mixed
* @return string
*/
function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '')
@@ -450,6 +459,8 @@
unset($defaults['checked']);
}
+ $extra = _attributes_to_string($extra);
+
return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
}
}
@@ -464,13 +475,16 @@
* @param mixed
* @param string
* @param bool
- * @param string
+ * @param mixed
* @return string
*/
function form_radio($data = '', $value = '', $checked = FALSE, $extra = '')
{
is_array($data) OR $data = array('name' => $data);
$data['type'] = 'radio';
+
+ $extra = _attributes_to_string($extra);
+
return form_checkbox($data, $value, $checked, $extra);
}
}
@@ -484,7 +498,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_submit($data = '', $value = '', $extra = '')
@@ -495,6 +509,8 @@
'value' => $value
);
+ $extra = _attributes_to_string($extra);
+
return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
}
}
@@ -508,7 +524,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_reset($data = '', $value = '', $extra = '')
@@ -519,6 +535,8 @@
'value' => $value
);
+ $extra = _attributes_to_string($extra);
+
return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
}
}
@@ -532,7 +550,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_button($data = '', $content = '', $extra = '')
@@ -548,6 +566,8 @@
unset($data['content']); // content is not an attribute
}
+ $extra = _attributes_to_string($extra);
+
return '<button '._parse_form_attributes($data, $defaults).$extra.'>'.$content."</button>\n";
}
}