@@ -42,14 +42,15 @@ protected function _applyAttributes($element,&$attributes,$index){
4242 $ element ->fromArray ($ attributes );
4343 }
4444
45- protected function _addRules ($ element ,$ attributes ){
45+ protected function _addRules ($ element ,& $ attributes ){
4646 if (isset ($ attributes ["rules " ])){
4747 $ rules =$ attributes ["rules " ];
48- if (\is_array ($ rules ))
48+ if (\is_array ($ rules )){
4949 $ element ->addRules ($ rules );
50- else
51- $ element ->addRule ($ rules );
52- unset($ attributes ["rules " ]);
50+ }
51+ else
52+ $ element ->addRule ($ rules );
53+ unset($ attributes ["rules " ]);
5354 }
5455 }
5556
@@ -58,8 +59,9 @@ protected function _fieldAs($elementCallback,$index,$attributes=NULL,$identifier
5859 $ caption =$ this ->_instanceViewer ->getCaption ($ index );
5960 $ name =$ this ->_instanceViewer ->getFieldName ($ index );
6061 $ element =$ elementCallback ($ this ->getIdentifier ()."- " .$ name ,$ name ,$ value ,$ caption );
61- if (\is_array ($ attributes ))
62+ if (\is_array ($ attributes )){
6263 $ this ->_applyAttributes ($ element , $ attributes ,$ index );
64+ }
6365 return $ element ;
6466 });
6567 return $ this ;
@@ -110,7 +112,7 @@ public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=
110112
111113 public function fieldAsMessage ($ index ,$ attributes =NULL ){
112114 return $ this ->_fieldAs (function ($ id ,$ name ,$ value ,$ caption ){
113- $ mess = new HtmlMessage ($ id ,$ value );
115+ $ mess = new HtmlMessage (" message- " . $ id ,$ value );
114116 $ mess ->addHeader ($ caption );
115117 return $ mess ;
116118 }, $ index ,$ attributes ,"message " );
0 commit comments