Can set class attribute in array. (#521)
In case of you want to add class by condition.
```
Form::text('name', null, ['class' => [
'form-control-,
$error ? 'is-invalid' : '',
]]);
```
This commit is contained in:
1 parent
6d1ccebb53
commit
fda9d3dad8
3 files changed
+30
No files matched your search
@@ -455,6 +455,10 @@ class HtmlBuilder
|
||||
return $value ? $key : '';
|
||||
}
|
||||
|
||||
if (is_array($value) && $key === 'class') {
|
||||
return 'class="' . implode(' ', $value) . '"';
|
||||
}
|
||||
|
||||
if (! is_null($value)) {
|
||||
return $key . '="' . e($value, false) . '"';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user