@@ -28,12 +28,12 @@ private function _getLabelField($caption,$icon=NULL){
2828 protected function _addRules ($ element ,$ attributes ){}
2929
3030 protected function _fieldAs ($ elementCallback ,$ index ,$ attributes =NULL ,$ prefix =null ){
31- $ this ->setValueFunction ($ index ,function ($ value )use ($ index ,&$ attributes ,$ elementCallback ,$ prefix ){
31+ $ this ->setValueFunction ($ index ,function ($ value ) use ($ index ,&$ attributes ,$ elementCallback ,$ prefix ){
3232 $ name =$ this ->_instanceViewer ->getCaption ($ index )."[] " ;
3333 if (isset ($ attributes ["name " ])===true ){
3434 $ name =$ attributes ["name " ];
3535 }
36- $ element =$ elementCallback ($ this ->_getFieldIdentifier ($ prefix ),$ value , $ name );
36+ $ element =$ elementCallback ($ this ->_getFieldIdentifier ($ prefix ),$ name , $ value , "" );
3737 if (\is_array ($ attributes ))
3838 $ this ->_applyAttributes ($ element , $ attributes ,$ index );
3939 return $ element ;
@@ -75,30 +75,31 @@ public function fieldAsImage($index,$size=Size::SMALL,$circular=false){
7575 }
7676
7777 public function fieldAsAvatar ($ index ,$ attributes =NULL ){
78- return $ this ->_fieldAs (function ($ id ,$ value ,$ name ){
79- $ img = (new HtmlImage ($ id ,$ value ))->asAvatar ();
78+ return $ this ->_fieldAs (function ($ id ,$ name ,$ value ){
79+ $ img =new HtmlImage ($ id ,$ value );
80+ $ img ->asAvatar ();
8081 return $ img ;
8182 }, $ index ,$ attributes ,"avatar " );
8283 }
8384
8485
8586 public function fieldAsRadio ($ index ,$ attributes =NULL ){
86- return $ this ->_fieldAs (function ($ id ,$ value , $ name ){
87+ return $ this ->_fieldAs (function ($ id ,$ name , $ value ){
8788 $ input = new HtmlRadio ($ id ,$ name ,$ value ,$ value );
8889 return $ input ;
8990 }, $ index ,$ attributes ,"radio " );
9091 }
9192
9293 public function fieldAsInput ($ index ,$ attributes =NULL ){
93- return $ this ->_fieldAs (function ($ id ,$ value , $ name ){
94+ return $ this ->_fieldAs (function ($ id ,$ name , $ value ){
9495 $ input = new HtmlInput ($ id ,"text " ,$ value );
9596 $ input ->getField ()->setProperty ("name " , $ name );
9697 return $ input ;
9798 }, $ index ,$ attributes ,"input " );
9899 }
99100
100101 public function fieldAsCheckbox ($ index ,$ attributes =NULL ){
101- return $ this ->_fieldAs (function ($ id ,$ value , $ name ){
102+ return $ this ->_fieldAs (function ($ id ,$ name , $ value ){
102103 $ input =new HtmlCheckbox ($ id ,"" ,$ this ->_instanceViewer ->getIdentifier ());
103104 $ input ->setChecked (JString::isBooleanTrue ($ value ));
104105 $ input ->getField ()->setProperty ("name " , $ name );
@@ -107,7 +108,7 @@ public function fieldAsCheckbox($index,$attributes=NULL){
107108 }
108109
109110 public function fieldAsDropDown ($ index ,$ elements =[],$ multiple =false ,$ attributes =NULL ){
110- return $ this ->_fieldAs (function ($ id ,$ value , $ name ) use ($ elements ,$ multiple ){
111+ return $ this ->_fieldAs (function ($ id ,$ name , $ value ) use ($ elements ,$ multiple ){
111112 $ dd =new HtmlDropdown ($ id ,$ value ,$ elements );
112113 $ dd ->asSelect ($ name ,$ multiple );
113114 return $ dd ;
0 commit comments