Skip to content

Commit cefc135

Browse files
committed
Fix nullable value
1 parent 0a90317 commit cefc135

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/BootstrapForm.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,12 @@ public function staticField($name, $label = null, $value = null, array $options
276276
{
277277
$options = array_merge(['class' => 'form-control-static'], $options);
278278

279-
if (is_array($value) and isset($value['html'])) {
280-
$value = $value['html'];
281-
} else {
282-
$value = e($value);
279+
if ( ! is_null($value)) {
280+
if (is_array($value) and isset($value['html'])) {
281+
$value = $value['html'];
282+
} else {
283+
$value = e($value);
284+
}
283285
}
284286

285287
$label = $this->getLabelTitle($label, $name, $options);
@@ -795,7 +797,7 @@ protected function getLabelTitle($label, $name, $options)
795797
return Lang::get("forms.{$name}");
796798
}
797799

798-
$label = $label ?: str_replace('_', ' ', Str::title($name));
800+
$label = $label ?: str_replace('_', ' ', Str::title($name));
799801

800802
if (isset($options['required'])) {
801803
$label = sprintf('%s %s', $label, $this->getLabelRequiredMark());
@@ -1086,6 +1088,7 @@ protected function setErrorBag($errorBag)
10861088
$this->errorBag = $errorBag;
10871089
}
10881090

1091+
10891092
/**
10901093
* Flatten arrayed field names to work with the validator, including removing "[]",
10911094
* and converting nested arrays like "foo[bar][baz]" to "foo.bar.baz".

0 commit comments

Comments
 (0)