@@ -194,16 +194,20 @@ public function renderCellContent($column, $index)
194194
195195 $ hasError = false ;
196196 $ error = '' ;
197+ $ layoutConfig = array_merge ([
198+ 'offsetClass ' => 'col-sm-offset-3 ' ,
199+ 'labelClass ' => 'col-sm-3 ' ,
200+ 'wrapperClass ' => 'col-sm-6 ' ,
201+ 'errorClass ' => 'col-sm-offset-3 col-sm-6 ' ,
202+ ], $ this ->layoutConfig );
203+
204+ Html::addCssClass ($ column ->errorOptions , $ layoutConfig ['errorClass ' ]);
197205
198206 if ($ index !== null ) {
199207 $ error = $ column ->getFirstError ($ index );
200208 $ hasError = !empty ($ error );
201209 }
202210
203- if ($ column ->enableError ) {
204- $ input .= "\n" . $ column ->renderError ($ error );
205- }
206-
207211 $ wrapperOptions = [
208212 'class ' => 'field- ' . $ id
209213 ];
@@ -212,13 +216,26 @@ public function renderCellContent($column, $index)
212216 Html::addCssClass ($ wrapperOptions , 'has-error ' );
213217 }
214218
215- $ input = Html::tag ( ' div ' , $ input , $ wrapperOptions );
219+ Html::addCssClass ( $ wrapperOptions , $ layoutConfig [ ' wrapperClass ' ] );
216220
217- $ content = Html::beginTag ('div ' , ['class ' => 'form-group list-cell__ ' . $ column ->name ]);
218- $ content .= Html::label ($ column ->title , $ id , [
219- 'class ' => 'col-sm-2 control-label ' . (empty ($ column ->title ) ? ' sr-only ' : '' )
221+ $ content = Html::beginTag ('div ' , [
222+ 'class ' => 'form-group list-cell__ ' . $ column ->name . ($ hasError ? ' has-error ' : '' )
220223 ]);
221- $ content .= Html::tag ('div ' , $ input , ['class ' => 'col-sm-10 ' ]);
224+
225+ if (empty ($ column ->title )) {
226+ Html::addCssClass ($ wrapperOptions , $ layoutConfig ['offsetClass ' ]);
227+ } else {
228+ $ content .= Html::label ($ column ->title , $ id , [
229+ 'class ' => $ layoutConfig ['labelClass ' ] . ' control-label '
230+ ]);
231+ }
232+
233+ $ content .= Html::tag ('div ' , $ input , $ wrapperOptions );
234+
235+ if ($ column ->enableError ) {
236+ $ content .= "\n" . $ column ->renderError ($ error );
237+ }
238+
222239 $ content .= Html::endTag ('div ' );
223240
224241 return $ content ;
0 commit comments