Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allows for empty string or array without removing default formtag items

  • Loading branch information...
commit fa3d9ef65a7536cae5b01b6a58ca4a1bc8a40206 1 parent 29e7f85
@tgriesser tgriesser authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 system/helpers/form_helper.php
View
17 system/helpers/form_helper.php
@@ -968,7 +968,7 @@ function _parse_form_attributes($attributes, $default)
{
function _attributes_to_string($attributes, $formtag = FALSE)
{
- if (is_string($attributes) AND strlen($attributes) > 0)
+ if (is_string($attributes))
{
if ($formtag == TRUE AND strpos($attributes, 'method=') === FALSE)
{
@@ -980,7 +980,7 @@ function _attributes_to_string($attributes, $formtag = FALSE)
$attributes .= ' accept-charset="'.strtolower(config_item('charset')).'"';
}
- return ' '.$attributes;
+ return ' '.$attributes;
}
if (is_object($attributes) AND count($attributes) > 0)
@@ -988,7 +988,7 @@ function _attributes_to_string($attributes, $formtag = FALSE)
$attributes = (array)$attributes;
}
- if (is_array($attributes) AND count($attributes) > 0)
+ if (is_array($attributes))
{
$atts = '';
@@ -1001,12 +1001,15 @@ function _attributes_to_string($attributes, $formtag = FALSE)
{
$atts .= ' accept-charset="'.strtolower(config_item('charset')).'"';
}
-
- foreach ($attributes as $key => $val)
+
+ if (count($attributes) > 0)
{
- $atts .= ' '.$key.'="'.$val.'"';
+ foreach ($attributes as $key => $val)
+ {
+ $atts .= ' '.$key.'="'.$val.'"';
+ }
}
-
+
return $atts;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.