Skip to content

Commit 2ebdf0d

Browse files
committed
Add asList
1 parent 7a8d953 commit 2ebdf0d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Ajax/semantic/widgets/base/FieldAsTrait.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Ajax\semantic\html\collections\form\HtmlFormRadio;
2323
use Ajax\semantic\html\base\HtmlSemDoubleElement;
2424
use Ajax\semantic\html\elements\HtmlIcon;
25+
use Ajax\semantic\html\elements\HtmlList;
2526

2627
/**
2728
* trait used in Widget
@@ -179,6 +180,14 @@ public function fieldAsRadios($index,$elements=[],$attributes=NULL){
179180
return HtmlFormFields::radios($name,$elements,$caption,$value);
180181
}, $index,$attributes,"radios");
181182
}
183+
184+
public function fieldAsList($index,$classNames="",$attributes=NULL){
185+
return $this->_fieldAs(function($id,$name,$value,$caption) use($classNames){
186+
$result= new HtmlList($name,$value);
187+
$result->addClass($classNames);
188+
return $result;
189+
}, $index,$attributes,"list");
190+
}
182191

183192
public function fieldAsInput($index,$attributes=NULL){
184193
return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){

0 commit comments

Comments
 (0)