@@ -142,11 +142,13 @@ class FormHelper extends Helper {
142
142
'errorList ' => '<ul>{{content}}</ul> ' ,
143
143
'errorItem ' => '<li>{{text}}</li> ' ,
144
144
'file ' => '<input type="file" name="{{name}}"{{attrs}}> ' ,
145
+ 'fieldset ' => '<fieldset>{{content}}</fieldset> ' ,
145
146
'formstart ' => '<form{{attrs}}> ' ,
146
147
'formend ' => '</form> ' ,
147
148
'hiddenblock ' => '<div style="display:none;">{{content}}</div> ' ,
148
149
'input ' => '<input type="{{type}}" name="{{name}}"{{attrs}}> ' ,
149
150
'label ' => '<label{{attrs}}>{{text}}</label> ' ,
151
+ 'legend ' => '<legend>{{text}}</legend> ' ,
150
152
'option ' => '<option value="{{value}}"{{attrs}}>{{text}}</option> ' ,
151
153
'optgroup ' => '<optgroup label="{{label}}"{{attrs}}>{{content}}</optgroup> ' ,
152
154
'select ' => '<select name="{{name}}"{{attrs}}>{{content}}</select> ' ,
@@ -724,8 +726,7 @@ protected function _domId($value) {
724
726
* @param array $fields An array of fields to generate inputs for, or null.
725
727
* @param array $blacklist A simple array of fields to not create inputs for.
726
728
* @param array $options Options array. Valid keys are:
727
- * - `fieldset` Set to false to disable the fieldset. If a string is supplied it will be used as
728
- * the class name for the fieldset element.
729
+ * - `fieldset` Set to false to disable the fieldset.
729
730
* - `legend` Set to false to disable the legend for the generated input set. Or supply a string
730
731
* to customize the legend text.
731
732
* @return string Completed form inputs.
@@ -794,18 +795,11 @@ public function inputs($fields = null, $blacklist = null, $options = array()) {
794
795
$ out .= $ this ->input ($ name , $ options );
795
796
}
796
797
797
- if (is_string ($ fieldset )) {
798
- $ fieldsetClass = sprintf (' class="%s" ' , $ fieldset );
799
- } else {
800
- $ fieldsetClass = '' ;
801
- }
802
-
803
- // TODO cleanup HTML helper usage.
804
798
if ($ fieldset ) {
805
799
if ($ legend ) {
806
- $ out = $ this ->Html -> useTag ('legend ' , $ legend ) . $ out ;
800
+ $ out = $ this ->formatTemplate ('legend ' , [ ' text ' => $ legend] ) . $ out ;
807
801
}
808
- $ out = $ this ->Html -> useTag ('fieldset ' , $ fieldsetClass , $ out );
802
+ $ out = $ this ->formatTemplate ('fieldset ' , [ ' content ' => $ out] );
809
803
}
810
804
return $ out ;
811
805
}
0 commit comments